Plain

All phrases

Every wording Plain understands, with an example you can run. Type a word to find a phrase.

Core steps

set NAME to VALUE

Keeps a value under a name. Lists and records are copied.

set score to 0
STEP and call it NAME

Keeps what a step gives back under a name.

ask "Your name?" and call it name
if CHECK

Takes the steps under it only when the check is yes.

if score is more than 10
otherwise if CHECK

Another check, tried when the ones above weren't yes.

otherwise if score is 10
otherwise

The steps to take when none of the checks above were yes.

otherwise
repeat N times

Takes the steps under it N times. Also: repeat once, repeat twice.

repeat 3 times
repeat forever

Repeats until you leave with "stop repeating" or end with "stop the program".

repeat forever
repeat until CHECK

Takes the steps, then checks. Stops once the check is yes.

repeat until guess is secret
repeat while CHECK

Checks first, and takes the steps while the check is yes.

repeat while lives is more than 0
repeat for each NAME in LIST

Takes the steps once for each item of the list.

repeat for each sale in sales
repeat for each NAME from A to B

Counts up from A to B. Write "down to" to count down.

repeat for each n from 1 to 10
stop repeating

Leaves the repeat it's in.

stop repeating
skip to the next round

Goes straight to the next round of the repeat.

skip to the next round
stop the program

Ends the program now.

stop the program
how to WORDS (NAME)

Makes a step of your own. Words in brackets are values you hand in.

how to greet (person)
give back VALUE

Ends your own step and hands back a value.

give back total
try

Takes the steps under it. If one has a problem, Plain goes to "if that fails".

try
if that fails

The steps to take when a step under "try" had a problem. "the problem" says what went wrong.

if that fails
the problem

Inside "if that fails", the message about what went wrong.

show "Plain couldn't do it: {the problem}"

Numbers and text

N% of VALUE

A part of a value, like 15% of a bill. "N percent of VALUE" works too.

show 15% of 80
VALUE rounded

Rounds to a whole number. Halves go up.

show 6.5 rounded
VALUE rounded to NUMBER [decimal] place|places

Rounds to that many decimal places. Halves go up.

You can also write: VALUE rounded to NUMBER decimal|decimals

show 6.375 rounded to 2 places
VALUE rounded down

Rounds down to a whole number.

show 7.9 rounded down
VALUE rounded up

Rounds up to a whole number.

show 7.1 rounded up
VALUE as a number

Turns text like "42" into the number 42.

show "42" as a number
VALUE as text

Turns any value into text, the way "show" would show it.

show 42 as text
the length of TEXT

How many characters, counting spaces and punctuation.

show the length of "hello"
TEXT in uppercase

The same text in capital letters.

You can also write: TEXT in capitals

show "hello" in uppercase
TEXT in lowercase

The same text in small letters.

show "HELLO" in lowercase
the words of TEXT

A list of the words in the text.

show the words of "one two three"
the lines of TEXT

A list with one item for each line of the text.

show the lines of story
the characters of TEXT

Every character in the text: letters, digits, spaces and punctuation.

show the characters of "abc"
TEXT split by TEXT

Splits the text into a list wherever the separator appears.

show "a,b,c" split by ","
LIST joined with TEXT

Joins the items of a list into one text, with the separator between them.

show colors joined with " - "
replace TEXT with TEXT in NAME

Changes every match in the text kept under that name. Capitals must match exactly.

replace "cat" with "dog" in story

Show and ask

show VALUE

Shows the value on its own line. Lists show as "a, b and c", and tables as lined-up columns.

show "Hello there"
ask QUESTION

Shows the question and waits for an answer. An answer that looks like a number becomes one.

ask "What is your name?" and call it name
ask QUESTION with choices LIST

Shows a numbered menu. You can type the number or the choice itself. Plain asks again if the answer is neither.

ask "Which size?" with choices "small", "medium" and "large" and call it size
wait NUMBER second|seconds

Pauses for that many seconds.

wait 2 seconds
wait NUMBER minute|minutes

Pauses for that many minutes.

wait 1 minute
wait for enter

Pauses until you press Enter.

wait for enter
clear the screen

Clears everything shown so far.

clear the screen

Time and chance

start the timer

Starts the stopwatch again from 0.

start the timer
the timer

Seconds since "start the timer", or since the program began, to 1 decimal place.

show the timer
the time now

The time as text, like "14:05".

show "It is {the time now}."
the date today

The date as text, like "2026-10-23".

show "Today is {the date today}."
a random number from NUMBER to NUMBER

A whole number between the two numbers, both included.

You can also write: a random number between NUMBER and NUMBER

set roll to a random number from 1 to 6
a random item from LIST

One item of the list, picked by chance.

show a random item from a list of "heads" and "tails"
shuffle LIST

Puts the list in a random order.

shuffle cards

Lists and tables

a list of LIST

Makes a list. Commas and a final "and" separate the items.

set colors to a list of "red", "green" and "blue"
an empty list

A list with nothing in it yet.

set todos to an empty list
a new record

A record with no fields yet. Add fields with: set person's name to "Ann".

set person to a new record
a copy of VALUE

A separate copy, so changing one doesn't change the other.

set backup to a copy of todos
item NUMBER of LIST

The item at that position. Positions start at 1.

show item 2 of colors
the first item of LIST

The first item.

show the first item of colors
the last item of LIST

The last item.

show the last item of colors
the first NUMBER items of LIST

The first N items, or all of them if there are fewer.

show the first 2 items of colors
the last NUMBER items of LIST

The last N items, or all of them if there are fewer.

show the last 2 items of colors
the number of LIST

How many items the list has.

show the number of colors
the total of LIST

Adds up the numbers. Empty cells (nothing) are skipped.

show the total of a list of 1, 2 and 3
the average of LIST

The total divided by how many numbers there are. Empty cells are skipped.

show the average of a list of 1, 2 and 3
the largest of LIST

The largest number, or the last text in A to Z order.

show the largest of a list of 3, 9 and 4
the smallest of LIST

The smallest number, or the first text in A to Z order.

show the smallest of a list of 3, 9 and 4
the different items of LIST

Each item once, in the order they first appear.

show the different items of a list of 1, 2, 2 and 3
the different FIELD of TABLE

Each value of one column once, in the order they first appear.

show the different categories of expenses
add VALUE to NAME

Adds a number to a number, or puts an item at the end of a list.

add 1 to score
subtract VALUE from NAME

Takes a number away from a number.

subtract 1 from lives
remove item NUMBER from LIST

Removes the item at that position.

remove item 1 from todos
remove VALUE from LIST

Removes the first item that matches.

remove "milk" from shopping
sort LIST

Sorts the list, smallest first. Text sorts A to Z, ignoring capitals.

You can also write: sort LIST smallest first

sort names
sort LIST largest first

Sorts the list, largest first.

sort scores largest first
sort LIST by FIELD

Sorts a table by one field, smallest first.

You can also write: sort LIST by FIELD smallest first

sort sales by amount
sort LIST by FIELD largest first

Sorts a table by one field, largest first.

sort sales by amount, largest first
reverse LIST

Puts the list in the opposite order.

reverse names

Files

read FILE reads a file or web page

Reads a file or a web page. A .csv file gives a table, .json gives records and lists, and anything else gives text. A web address gives the page; JSON replies become records and lists.

read "sales.csv" and call it sales
read the lines of FILE reads a file or web page

Reads a file (or web page) as a list with one item for each line.

read the lines of "todos.txt" and call it todos
save VALUE to FILE changes a file

Replaces the file. To .csv a table saves as rows; to .json any value saves as JSON; anything else saves as text, with a list as one item per line.

save todos to "todos.txt"
add VALUE to the file FILE changes a file

Adds one line at the end of the file, and makes the file if needed.

add "Saw a fox" to the file "diary.txt"
the file FILE exists

Yes if the file is there, no if it isn't.

if the file "todos.txt" exists
the file FILE does not exist

Yes if the file isn't there.

if the file "todos.txt" does not exist
the files in FOLDER

The names of the files in a folder, A to Z.

show the files in "photos"
rename FILE to FILE changes a file

Gives a file a new name.

rename "old.txt" to "new.txt"

The web

send VALUE to ADDRESS sends data over the internet

Sends records and lists as JSON, and anything else as text. The reply comes back the way "read" gives it.

send message to "https://example.com/api" and call it reply
the text of PAGE

The words on a web page, without its formatting codes.

show the text of page
the links of PAGE

A list of the addresses that a web page links to.

show the links of page

Plain's special words

Plain uses these words to tell where a name ends, so they can't be part of a name:

and as by contains divided does eight eleven ends equals exists false five four from in is it its joined minus multiplied nine no not nothing of one or percent plus rounded seven six split starts ten than then three times to true twelve two where with yes zero

Other ways you can write things

Plain understands these too. Each one means exactly the same as the main wording. plain tidy changes them to the main wording for you.