Variables in Cyrus are declared using the # symbol:
#name: OptionalType = Value;
Example
#count: int = 42; // explicit type annotation
#message: char* = "Hello, Cyrus!"; // explicit type annotation
#flag = true; // type inferred as bool
The # prefix is unique to Cyrus. It makes variable declarations easy to spot and improves editor syntax highlighting.
Using # instead of keywords like var or let keeps code shorter and visually distinct.
Type inference works automatically when the type is omitted.
Variables that are declared without an initial value are automatically zero-initialized:
#x: int;
#y: float64;
#ptr: int*;
printf("%d\n", x); // prints 0
printf("%f\n", y); // prints 0.0
printf("%p\n", ptr); // prints null / 0
In Cyrus, variables are mutable by default. You can assign new values to them after their initial declaration:
#counter: int = 0;
#counter = 10; // allowed
To declare a read-only variable, use the const keyword before the type:
#pi: const float64 = 3.14159;
#pi: const float64; // ❌ const variable must be initialized
#pi = 3.14159; // ❌ cannot assign to const variable