# This is a single line comment.
###
This is a multi
line comment
###
# A very basic log statement
Log |"Hello, World!"|
###
As you will see, a statement is a plain english sentence with zero or more parameters.
parametes are expressions/literals enclosed within pipe symbol `|`.
Statements cannot begin with reserved keywords like (if, for, while, else, return, continue, etc).
Each line is a single statment. And all statements & keywords are case-insensitive.
The variables used inside parameters are still case-sensitive).
Statements (except assignment) cannot begin with parameters.
But it can still contain the reserved keywords in the middle of the statement
They also cannot contain curly-braces "{", "}", pound sign "#", or new lines.
Every statement will always return a Literal (None, Bool, Int, Float, String, Array, Map)
###
# Here are some different ways you can write the same `Log` statement in
# They all do the same as the Log statement above
log |"Hello, World!"|
LOG |"Hello, World!"|
Log|"Hello, World!"|
Log | "Hello, World!" |
Log |"Hello, World!"|
# Data Types (Bool, Int, Float, String, Array, Map)
Log |true|
Log |false|
Log |3|
Log |3.3|
Log |"Hi, There!"|
Log |[true, false, 3, 3.3, "Hi, There!"]|
Log |{bool_true: true, bool_false: false, integer: 3, float: 3.3, string: "Hi, There!", array: [1, 1.3], dict: {key: "value"}}|
# Assignment statments: It always starts with a parameter followed by `=`
# The RHS can be a parameter or a sentence.
|a| = |(4 + 5) * 6|
log |a + 10|
###
Custom Statements
###
# Declaration
What is square-root of |number| divided by |divisor| equals, eh?!... {
|square| = |number ^ 2|
Return |square/divisor|
Log |"This statement will never execute"|
}
# Invocation (case-insensitive)
|answer| = WHAT is sQuAre-RoOt of |6| divided by|2|equals, EH?!...
Log |"Here is your answer:"|
Log |answer|
###
IF statments
###
|a| = |10|
|b| = |11|
If | a>b | {
Log |"This will never get logged!"|
}
If | a>b | {
Log |"a is greater"|
} Else {
Log |"b is greater"|
}
If | b>a | {
Log |"b is greater again"|
} Else {
Log |"a is greater"|
}
###
FOR statement
###
For |i| in |[1, 2, 3, 4, 5]| {
if |i > 3| {
Log |"for: i is greater than 3, breaking..."|
Break
}
Log |i|
}
For |i| in |[1, 2, 3, 4, 5]| {
if |i < 3| {
Log |"for: i is lesser than 3, skipping log..."|
Continue
}
Log |i|
}
###
While Statement
###
|i| = |0|
while |i<10| {
|i| = |i+1|
if |i < 3| {
Log |"while: i is lesser than 3, skipping log..."|
Continue
}
log |i|
if |i>5| {
Log |"while: i is greater than 5, breaking..."|
Break
}
}
###
Try/Catch
###
Try {
Log |5|
Log |"This will always execute"|
} Catch {
Log |"This is never execute"|
}
Try {
Log |undefined_variable|
Log |"This will never execute"|
} Catch {
Log |"This will always execute"|
}