Learn Common by playing
The Common Quest
Ten levels from the gate to the throne. Each level teaches one new word. Write the code, press Run, and your progress is saved.
RankWanderer
XP0
Levels0 / 10
- 1. The Gate
- 2. Name your hero
- 3. The coin purse
- 4. The troll bridge
- 5. Pack your bag
- 6. The armory
- 7. The echo cave
- 8. The spellbook
- 9. Know thy dragon
- 10. The final battle
π°
Level 1 of 10
The Gate
The gate of Commonhold opens only for a traveller who speaks. Make the page say the password.
β¨ New spell:
showshow puts something on the page. Text goes in double quotes. Every line starts with a command, and show is the first one to know.
show "Hello, world!"
Goal Make the page say: Open, gate!
Hint
Type show, a space, then the password in double quotes.
After three tries the answer appears here.
Press Run to see what the visitor would see.
Your spellbook
The words you have learned so far. Each opens in the glossary.
β
level 1
βlevel 2
βlevel 3
βlevel 4
βlevel 5
βlevel 6
βlevel 7
βlevel 8
βlevel 9
βlevel 10
This is the only page on the site that uses JavaScript, and only for the editor's hints. Without it the quest still works: write, press Run, and Common checks your code on the server with try.
- [ ]"text with [a value] inside"put a value into text. A value is anything you could write after 'set x to': a name, math, count of, query. Write \[ for a real bracket
- addadd VALUE to LISTput a value at the end of a list
- andA and Bboth must be yes
- askask database "SQL" with VALUE, ...run a query; each ? in the SQL takes the next value safely. Gives a list of records
- codeshow code TEXTshow Common code highlighted, the way a cl-code block does, but from a value
- containsA contains Byes if text A has B inside it, or list A has item B
- countcount of LISThow many items a list has, or letters in text
- datedate of TEXTa date like 2026-10-24 written out: 24 October 2026
- dayday of TEXTthe day of a date as a number
- dictionarydictionaryevery word of the language as records: word, form, meaning, example
- emailTEXT is an emailyes if the text is one email address, like ada@example.com. Check a visitor's address with it before you use it
- endendclose an if, for each, repeat, to, send email, record or text block
- firstfirst of LIST / first N of LISTthe first item, or the first N items (or letters of text)
- forfor each NAME in LISTrun the lines below once for every item
- forgetforget "name" / forget everythingdrop a remembered value, or all of them (sign out)
- formform "field"what the visitor typed in a submitted form (POST)
- givegive VALUEinside a verb: hand this value back and finish. A verb that gives can be used wherever a value goes
- gogo to "/page.html"send the visitor to another page and stop
- hashhash of TEXTa one-way scramble of a password, safe to store (PBKDF2-HMAC-SHA256)
- ifif CONDITIONrun the lines below when the condition is yes
- includeinclude "file.html"insert another page here
- isA is Bequal. Also: is not, is more than, is less than, is at least, is at most, is between A and B, is empty
- itemitem N of LISTone item by position, counting from 1; or a column by name: item "price" of lamp
- lastlast of LIST / last N of LISTthe last item, or the last N items (or letters of text)
- listempty lista list with nothing in it yet
- lowercaselowercase of TEXTthe text in small letters
- matchesTEXT matches HASHyes if the text is the password behind the hash
- monthmonth of TEXTthe month of a date as a name
- nonothe answer no
- notnot Aflip yes and no
- nownowthe date and time, like 2026-10-24 18:30
- numbernumber of TEXTthe text as a number, so math works on it
- ofCOLUMN of RECORDone column of a record, like name of recipe. Any column name works
- openopen database "file.db"open a SQLite file next to the page, or a Postgres server with postgres://user:password@host/dbname
- orA or Beither can be yes
- otherwiseotherwise [if CONDITION]what to run when the condition above was no
- paragraphsparagraphs of TEXTa list of the paragraphs (separated by blank lines)
- pathpaththe URL path, like /about. The visitor typed it, so it is made safe like query
- queryquery "name"what the visitor typed in the URL after ?name=
- rawshow raw VALUEshow text exactly as it is, with no safety
- recordset NAME to record then column: VALUE lines, then enda record of your own, like a row you made up. Read a column with 'price of lamp', change one with 'set price of lamp to 15'
- rememberremember "name" as VALUEkeep a value for this visitor until they forget it (a signed cookie)
- rememberedremembered "name"a value kept for this visitor, or empty text
- repeatrepeat NUMBER times [until CONDITION]run the lines below that many times, or fewer with 'until CONDITION': stop as soon as it is yes
- replacereplace "a" with "b" in TEXTthe text with every a changed to b
- reversereverse of LISTthe list back to front
- sendsend email to "you@site.com" then subject:, body:, reply to:, from: lines, then endsend an email to an address you wrote yourself (never a visitor's). While developing it is saved in the private outbox/ folder; behind a web server it goes through sendmail. At most 3 per page and 20 an hour
- setset NAME to VALUEcreate or replace a variable; VALUE, VALUE makes a list. 'set COLUMN of RECORD to VALUE' changes one column
- showshow VALUE / show ... endshow a value on the page (visitor text is made safe). On its own, show opens a block of text that runs until a line saying end
- sortsort of LISTthe list in order (numbers by size, text A to Z)
- splitsplit TEXT by "/"a list of the pieces between each separator
- telltell database "SQL" with VALUE, ...run SQL that changes the database (insert, update, delete)
- toto NAME ARG ... then lines, then enddefine a verb: your own command. Call it by name with one value per ARG. Inside, 'give VALUE' hands a value back
- todaytodaythe date, like 2026-10-24
- trimtrim of TEXTthe text without spaces at the ends
- trytry TEXTrun text as Common in a sandbox and give back what it said. No files, database, cookies or redirects; loops stop after 20000 steps and memory at 64 MB. For practice pages
- uppercaseuppercase of TEXTthe text in capitals
- yearyear of TEXTthe year of a date as a number
- yesyesthe answer yes