The 'yap' keyword is used to output text to the screen. It is similar to 'print' in other languages.
yap ("Hello, YapScript!");
Use 'kick off' to declare variables in YapScript. It's the language's way to introduce a variable.
kick off num = 42; kick off name = "YapScript";
The 'tellMe' keyword takes user input and stores it in a variable.
kick off x = tellMe("What's your name?")
Define reusable blocks of code using the 'letHimCook' keyword.
letHimCook greet() { yap ("Welcome to YapScript!"); } greet();
'ohhReally' starts an if block, and 'nahMan' starts an else block. These are used for conditional logic.
ohhReally (num > 10) { yap ("Number is greater than 10!"); } nahMan { yap ("Number is 10 or less!"); }
'LoopyLoopy' is used for creating loops, similar to for or while loops in other languages.
LoopyLoopy (i = 0; i < 5; i++) { yap ("Iteration: " + i); }
Here’s a simple "Hello World" program in YapScript:
yap ("Hello, World!");
This program asks for a name and greets the user:
letHimCook greet(L){ yap("Hello "+L); } kick off x = tellMe("What's your name??") greet(x);
Here’s a simple if-else function:
kick off num = tellMe("Enter the number") ohhReally (num > 10) { yap ("Number is greater than 10!"); } nahMan { yap ("Number is 10 or less!"); }