๐Ÿงช

The Code Lab

Pseudocode, JavaScript, Python, PHP, WordPress, web pages and React โ€” write it, run it, break it, fix it. Everything runs safely right here in your browser.

๐Ÿงฉ Pseudocode quick reference

BEGIN โ€ฆ END program start & end
TAKE A, B input from the user
SET X = 10 store / change a value
DISPLAY X, "text" show output

IF โ€ฆ THEN / ELSE IF / ELSE / END IF
FOR I = 1 TO 10 [STEP 2] โ€ฆ END FOR
FOR EACH X IN LIST โ€ฆ END FOR
WHILE โ€ฆ END WHILE ยท REPEAT 5 TIMES โ€ฆ END REPEAT

FUNCTION F(A, B) โ€ฆ RETURN โ€ฆ END FUNCTION
[1, 2, 3] lists (index from 0) ยท {"k": 1} maps
ADD X TO LIST ยท REMOVE X FROM LIST
MOD DIV AND OR NOT ยท LENGTH() MAX() MIN() POP()

Open the full cheat sheet โ†’

โŒจ๏ธ Reading input & printing output in each language
LanguageRead the next inputPrint a line
๐Ÿงฉ PseudocodeTAKE NDISPLAY N
โšก JavaScriptconst n = Number(prompt())console.log(n)
๐Ÿ Pythonn = int(input())print(n)
๐Ÿ˜ PHP$n = (int) readline();echo $n, "\n";

Put one input value per line in the Inputs box. Web pages and React components show a live preview instead, and their console.log messages appear under the preview.

๐Ÿ›ก๏ธ Is it safe? What runs where?

Your code runs in a locked sandbox inside your browser. It canโ€™t see this website, your account or your files. JavaScript runs instantly; Python and PHP download a small WebAssembly runtime the first time you use them (a few seconds, then itโ€™s cached). Programs that run longer than a few seconds are stopped automatically, so an accidental infinite loop can never freeze your page.