x = 10; # Inline comment
10) and Floating-point (3.14)."Hello").true and false.[1, 2, 3]).{key : value}).
# Variables
x = 10;
# Constants
constant PI = 3.14;
Fahrenheit uses block scoping. Modifiers control visibility:
global: Accessible everywhere.local (default): Local to script execution.private, protected: For structure fields/methods.Standard arithmetic (+, -, *, /, %), comparison (==, !=, >, <, >=, <=), and logical (&&, ||, !) operators are supported.
Compound Assignment: +=, -=, *=, /=
Ternary Operator: condition ? val1 : val2
Interpolation: "Hello ${name}!"
Multiline: Use triple quotes """ or '''. Multiline strings preserve whitespaces and newlines.
Use the enumerated keyword for fixed sets of constants.
enumerated Status { PENDING, ACTIVE, INACTIVE }
status = Status.ACTIVE;
if (status == Status.ACTIVE) {
print("User is active");
}
if (x > 5) {
print("High");
} else {
print("Low");
}
# While
while (i < 5) { i = i + 1; }
# For
for (i = 0; i < 10; i++) { print(i); }
# Foreach (Arrays & Strings)
foreach (item : list) { print(item); }
switch (val) {
case 1: print("One"); break;
default: print("Other");
}
try {
throw "Error";
} catch (e) {
print("Caught: " + e);
} finally {
print("Cleanup");
}