digits
: Represents both integers and floating-point numbers. E.g.,vibe digits x mood 5;
vibes
: Represents strings. E.g.,vibe vibes name mood "VibeScript";
feels
: Represents boolean values (woke
for true andbig yikes
for false). E.g.,vibe feels flag mood woke;
mood
: Assignment operator. E.g.,vibe digits score mood 100;
glowUp
: Increment operator. E.g.,score glowUp;
glowDown
: Decrement operator. E.g.,score glowDown;
- Arithmetic operators:
+
,-
,*
,/
(no custom slang for these to keep performance and familiarity).
bet
: If statement.bet (condition) { // code }
no cap
: Else statement.bet (condition) { // code } no cap { // alternate code }
bop
: For loop.bop (vibe digits i mood 0; i < 10; i glowUp) { // code }
sus
: While loop.sus (condition) { // code }
ok boomer
: Break statement. Used to exit a loop.
slay
: Define a function.slay vibes greet() { flex("Hello, VibeScript!"); snatched "Done"; }
fire
: Call a function. E.g.,fire greet();
snatched
: Return statement to exit a function with a value.
shook
: Try block.shook { // code that may throw an exception } salty (error) { // handle exception }
flex
: Print to output. E.g.,flex("Hello, World!");
spill
: Take input. E.g.,vibe vibes name mood spill("What's your name?");
tea
: Used to start a comment. Everything aftertea
on the line is ignored.tea This is a comment
woke
: Equivalent to true.big yikes
: Equivalent to false.
clout
: Import or include libraries.clout "math_library";
dead
: Exit the program. E.g.,dead;
- Variables are declared using
vibe
followed by the type and an optional initial value.vibe digits age mood 21; vibe vibes name mood "VibeScript"; vibe feels isReady mood woke;
- Assignment: Uses
mood
operator.x mood 10;
- Increment/Decrement:
glowUp
andglowDown
can be used as post-increment/decrement.
- If-Else:
bet
starts an if-statement,no cap
provides the else clause. - Loops:
- For loop starts with
bop
and contains initialization, condition, and increment. - While loop starts with
sus
.
- For loop starts with
- Definition: Functions are defined with
slay
, taking optional parameters, and end withsnatched
to return a value. - Invocation: Functions are called using
fire
.
- Try-Catch: Encapsulate code in
shook
withsalty
to catch and handle errors.
Here's an example VibeScript code snippet to illustrate these rules:
tea VibeScript example program
clout "standard_library";
slay digits add(vibe digits x, vibe digits y) {
snatched x + y;
}
vibe digits total mood 0;
bop (vibe digits i mood 0; i < 5; i glowUp) {
bet (i % 2 mood 0) {
flex("Even number");
} no cap {
flex("Odd number");
}
}
vibe vibes name mood spill("What's your name?");
flex("Hello, " + name + "!");
shook {
fire add(5, 10);
} salty (error) {
flex("An error occurred: " + error);
}
dead;