main.ks
Output

Run your code to see output

Hello World

Lettuce output with the smallest valid v2 program.

Arithmetic Operations

Alby-Setin plus with extra, without, on repeat, and split by.

Loops & Conditionals

Anita, Antil, and state updates working together.

Object-Oriented Programming

Kit, Dewey, Fresh, and Europe in one example.

Functions & Return

Doozy functions with parameters and Backatcha.

Arrays & Dictionaries

list with, Oxford, Whichy, Keysy, and Slotta.

Break & Continue

Anita also, Enough, and Carryon in loops.

Input & Error Handling

Askem input with Chance / Unlucky recovery.

How Every Statement Works

Knock knock
Who's there?
[Command]
[Command] who? [payload]

The Full Joke

Knock knock.
Who's there?
Lettuce.
Lettuce who?
Lettuce write some code.

Output

Knock knock
Who's there?
Lettuce
Lettuce who? "Hello!"

Variables

Knock knock
Who's there?
Alby-Setin
Alby-Setin who? x to 10

Arithmetic

with extra  -> +
without     -> -
on repeat   -> *
split by    -> /

Comparisons

greater than
less than
equal to
not equal to
Nope [expression]

Conditionals

Knock knock
Who's there?
Anita
Anita who? x greater than 5
    [statements]
Anita also x equal to 5
    [statements]
Otherwise
    [statements]
Done

While Loops

Knock knock
Who's there?
Antil
Antil who? x less than 10
    [statements]
Done

For Loops

Knock knock
Who's there?
Wanna
Wanna who? i from 1 to 5
    [statements]
Done

Loop Control

Enough   -> break
Carryon  -> continue

Classes & Objects

Knock knock
Who's there?
Kit
Kit who? Person with name and age

Knock knock
Who's there?
Dewey
Dewey who? greet for Person
    [statements]
Done

Knock knock
Who's there?
Alby-Setin
Alby-Setin who? p to Fresh Person 
with name "Alice" and age 30

Method Calls & Attributes

Europe who? greet on person
Justin who? age from person
Alby-Setin who? age of person to 31

Functions

Knock knock
Who's there?
Doozy
Doozy who? add with left and right
    Knock knock
    Who's there?
    Backatcha
    Backatcha who? left with extra right
Done

Arrays

list with 1, 2, 3
Sherwood who? 4 to nums
Iva who? from nums
Patcha who? 0 of nums to 99
Howie nums
Whichy 1 from nums
Dosset Dave 99 in nums

Dictionaries

Oxford with name "Alice" and age 30
Keysy name from person
Slotta who? city of person to "Phoenix"
Dosset Dave age in person
Skipper who? age from person

Input & Errors

Askem "What is your name?"

Chance who?
    [statements]
Unlucky
    [statements]
Done

Booleans & Comments

true
false
Nope true

# This is a comment