01 Sentences, not symbols
Math uses plus, times and divided by. Text goes after the words.
let first number be 20
let second number be 22
say first number plus second number
a programming language for people who would rather write sentences
Plainly programs read like instructions to a friend. It checks your program before it runs, explains problems in words, and grows with you from your first say to real websites and chat bots.
Plainly is created and owned by its community author (christy395 on GitHub), MIT licensed. Enzonic does not own Plainly; we host and run a reviewed copy. Upstream repository.
// 01 what plainly is
Every line of a Plainly program is one sentence. There are no brackets to balance and no semicolons to forget. Names can be several words long, and blocks close with words like end if.
Math uses plus, times and divided by. Text goes after the words.
let first number be 20
let second number be 22
say first number plus second number
Plainly checks types before anything runs and tells you what went wrong, on which line, in words.
let score be 7
let label be the words points
say score plus label
line 3: 'plus' needs two numbers but got number and text. To join text, use 'followed by'.
A value that might be missing is a maybe, and you have to say what happens when it is.
let parsed be parsed number of the words 42 end words
let safe be parsed or else 0
say safe
The same sentences build small websites and Discord or Telegram bots, with permissions you declare up front.
allow running a Discord bot
when a Discord message arrives do
reply with the words Hello followed by the message author
end when
start the Discord bot
// 02 language tour
Each stop shows a small program. Open any of them in the playground to change it and run it. Prefer to learn by doing? The interactive tutorial walks through 18 short steps with checks and hints.
let gives a name to a value, once. set, add and subtract change it later. Names can be up to six words, and followed by joins values with a space.
let my name be the words Sam
let my age be 12
say my name followed by the words is followed by my age
set my age to 13
add 1 to my age
say the words Next year Sam is followed by my age
Sam is 12 Next year Sam is 14
Choose a branch with if ... then, add otherwise if and otherwise, and close with end if. Compare with is, is not, is at least, is greater than; combine with and, or, not.
let score be 82
if score is at least 90 then
say the words Excellent
otherwise if score is at least 60 then
say the words Passed
otherwise
say the words Try again
end if
Passed
repeat N times do runs a block a fixed number of times. while ... do keeps going as long as a condition is true. In the playground a loop that never ends is stopped after 5 seconds.
repeat 3 times do
say the words Hip hip hooray!
end repeat
let count be 1
while count is at most 3 do
say the words Counting followed by count
add 1 to count
end while
Hip hip hooray! Hip hip hooray! Hip hip hooray! Counting 1 Counting 2 Counting 3
define makes your own command. Inputs come after of (more with with), the result type after giving, and give back returns it. Plainly checks that every path gives a value back.
define rectangle area of width as number with height as number giving number
give back width times height
end define
define fizz of number as number giving text
if number modulo 15 is 0 then
give back the words FizzBuzz end words
otherwise if number modulo 3 is 0 then
give back the words Fizz end words
end if
give back the words end words joined to number
end define
say rectangle area of 5 with 4
say fizz of 9
say fizz of 7
20 Fizz 7
A record groups named fields. Make one with a new ... with and read a field with name of apple.
a record called item has name as text and price as number
let apple be a new item with name the words apple end words and price 3
say name of apple
say price of apple times 2
apple 6
A list holds values of one kind, joined with and. add ... to appends, for each walks it, entry 1 of reads the first item, and length of, largest of and smallest of summarize it.
let pets be a list of the words cat and the words dog and the words fish
add the words bird end words to pets
for each pet in pets do
say the words I like followed by pet
end for
say the words I have followed by length of pets followed by the words pets
let scores be a list of 4 and 8 and 15
say largest of scores
I like cat I like dog I like fish I like bird I have 4 pets 15
Plainly has no null. parsed number of gives a maybe number: use or else for a default, or has a value as to unwrap it safely.
let first be parsed number of the words 42 end words
let second be parsed number of the words hello end words
say second or else 0
if first has a value as found then
say the words I found end words followed by found plus 1
otherwise
say the words nothing there end words
end if
0 I found 43
Routes are when someone visits the path ... blocks that build a page with show and answer with reply with. Websites run on your own server, not in the playground.
when someone visits the path home do
show a heading with the words Welcome to my site end words
show a paragraph with the words Built in plain English. end words
reply with the page
end when
when someone visits the path hello do
let who be the visitor sent name
reply with the words Hello end words followed by who
end when
start the server on port 8099
runs on Enzonic On panel.enzonic.com, choose Create, then Websites, then pick "Plainly".
Ask permission with allow running a Discord bot (or Telegram), handle messages in a when block, then start it. The token stays out of your code: it comes from the PLAINLY_SECRET_DISCORD_TOKEN secret.
allow running a Discord bot
when a Discord message arrives do
let said be the message text
if said contains the words hello end words then
reply with the words Hello followed by the message author
otherwise if said contains the words help end words then
reply with the words I can say hello. Try it!
end if
end when
start the Discord bot
runs on Enzonic Bots need to stay online, so they run on your own server: on panel.enzonic.com, choose Create, then Bots, then pick "Plainly".
// 03 playground
Programs run on our servers in a sealed sandbox with no network, or instantly in your browser. Press Ctrl/⌘ + Enter to run. For bigger programs, open the full-screen IDE: files, suggestions, hover docs, live checks and a command palette.
No network at all. Programs run in a container started with internet access disabled. A program cannot reach any website, API or other server.
Fresh every time. Each run is a new process, under its own unprivileged user, in an empty temporary folder that is deleted afterwards. Nothing carries over between runs or between people.
Hard limits. 5 seconds, 256 MB of memory, 1 MB per file, 64 KB of output and a handful of processes. Anything past a limit is stopped.
Plain programs only. Websites and bots are refused here; they belong on your own server. Your code is never stored: share links carry the code inside the link itself.
// 04 run it on enzonic
When your program is a bot that should answer all day, or a website people can visit, give it its own server.
Sign in at panel.enzonic.com and choose Create.
Choose Bots or Websites, then pick the Plainly card. It runs Enzonic's reviewed copy of Plainly in its own container, and the free tier is included.
Put your program in main.plain, add your bot token as a secret if it is a bot, and press start.
// 05 credits
Created and owned by christy395. Released under the MIT License. Source, issues and roadmap: github.com/christy395/plainly.
We run a frozen fork pinned to upstream commit 70e81dd, reviewed before use, with small hardening patches for hosting. We never pull upstream changes automatically.
Editor by CodeMirror (MIT). Type set in JetBrains Mono (OFL). Examples and the in-browser compiler come from the Plainly project.
This site is an Enzonic Labs experiment: we host interesting community projects and give them a place to run.