EXAMPLES

Ten scripts ready to run.

Each example shows the code, the exact output it prints and what to remember. The link under each script opens it in the compiler, already loaded.

From the simplest to the fullest.

Hello world

Output
πŸ—£οΈπŸŒœπŸ’¬Hello, world! πŸ‘‹πŸ€«πŸŒ›πŸ™
Hello, world! πŸ‘‹

The shortest possible script: πŸ—£οΈ prints, the moons wrap, and the text lives between πŸ’¬ and 🀫.

A variable

Output
score➑️7οΈβƒ£πŸ™
πŸ—£οΈπŸŒœscoreπŸŒ›πŸ™
7

The arrow stores the value in the variable. The variable name is written with regular letters.

A calculation

Output
price➑️1️⃣2οΈβƒ£πŸ™
quantity➑️3οΈβƒ£πŸ™
πŸ—£οΈπŸŒœpriceβœ–οΈquantityπŸŒ›πŸ™
36

The four operations work like on a calculator, with βž• βž– βœ–οΈ and βž—.

A condition

Output
age➑️1️⃣8οΈβƒ£πŸ™
πŸ€”πŸŒœageπŸ’ͺ1️⃣7οΈβƒ£πŸŒ›πŸ‘‰πŸ”“
  πŸ—£οΈπŸŒœπŸ’¬Access granted βœ…πŸ€«πŸŒ›πŸ™
πŸ”’πŸ™ƒπŸ‘‰πŸ”“
  πŸ—£οΈπŸŒœπŸ’¬Access denied βŒπŸ€«πŸŒ›πŸ™
πŸ”’
Access granted βœ…

If the condition between the moons is true, the first block runs. Otherwise the πŸ™ƒ block does.

Count from 1 to 5

Output
i➑️1οΈβƒ£πŸ™
πŸ”πŸŒœi🀏6οΈβƒ£πŸŒ›πŸ‘‰πŸ”“
  πŸ—£οΈπŸŒœiπŸŒ›πŸ™
  i➑️iβž•1οΈβƒ£πŸ™
πŸ”’
12345

As long as i is smaller than 6, the block runs. The last line moves the counter forward; without it the loop would never stop.

A countdown

Output
n➑️5οΈβƒ£πŸ™
πŸ”πŸŒœnπŸ’ͺ0οΈβƒ£πŸŒ›πŸ‘‰πŸ”“
  πŸ—£οΈπŸŒœnπŸŒ›πŸ™
  n➑️nβž–1οΈβƒ£πŸ™
πŸ”’
πŸ—£οΈπŸŒœπŸ’¬Liftoff πŸš€πŸ€«πŸŒ›πŸ™
54321Liftoff πŸš€

Same idea, but the counter goes down. The last line runs once the loop is over.

The 7 times table

Output
i➑️1οΈβƒ£πŸ™
πŸ”πŸŒœi🀏6οΈβƒ£πŸŒ›πŸ‘‰πŸ”“
  πŸ—£οΈπŸŒœ7οΈβƒ£βœ–οΈiπŸŒ›πŸ™
  i➑️iβž•1οΈβƒ£πŸ™
πŸ”’
714212835

One loop and one multiplication are enough to print a whole times table.

The sum from 1 to 10

Output
total➑️0οΈβƒ£πŸ™
i➑️1οΈβƒ£πŸ™
πŸ”πŸŒœi🀏1️⃣1οΈβƒ£πŸŒ›πŸ‘‰πŸ”“
  total➑️totalβž•iπŸ™
  i➑️iβž•1οΈβƒ£πŸ™
πŸ”’
πŸ—£οΈπŸŒœtotalπŸŒ›πŸ™
55

Two variables: one for the counter, one for the result that grows on every pass.

The length of a text

Output
messageβž‘οΈπŸ’¬Emoji Script πŸ€―πŸ€«πŸ™
πŸ—£οΈπŸŒœπŸ“πŸŒœmessageπŸŒ›πŸŒ›πŸ™
15

πŸ“ counts characters. Careful: an emoji often takes two characters for the browser.

Joining two texts

Output
nameβž‘οΈπŸ’¬YoannπŸ€«πŸ™
πŸ—£οΈπŸŒœπŸ’¬Hi πŸ€«βž•nameπŸŒ›πŸ™
Hi Yoann

βž• also glues two pieces of text together.

You can edit any of these scripts in the compiler, then click Share to get a link that reopens your own version.

YOUR TURN

Try the syntax
in the compiler.

The compiler is free, accountless and runs entirely in your browser.

See the full syntax β†’