Datatypes
Nara has numeric & logical primitive datatypes. These are always copied when moved around, and are immutable.
u8 (byte)
A unsigned 8-bit integer, values from 0 to 255.
CODE_PLAYGROUND
val offset: u8 = 128
print("Byte offset: " ++ offset)
TBD: wrap around behavior
32 bit numbers
Nara offers you:
u32, a unsigned 32-bit integer,i32, a signed 32-bit integer,f32, a 32-bit floating point number (IEEE-754),
CODE_PLAYGROUND
val n10: u32 = 123
val n11: i32 = -123
val n12: f32 = 123.456
64 bit numbers
Finally, Nara offers you:
u64, a unsigned 64-bit integer,i64, a signed 64-bit integer,f64, a 64-bit floating point number (IEEE-754),
CODE_PLAYGROUND
val n20: u64 = 123_456_789_000
val n21: i64 = -123_456_789_000
val n22: f64 = 123_456.789_000_123
Boolean
The bool can only ever be true or false
CODE_PLAYGROUND
val is_cool: bool = true
val is_verbose: bool = false
String
Strings are a reference type, so when moved around only its reference moves, not the actual value.
Still, strings are immutable, so once created a String cannot be changed.
CODE_PLAYGROUND
val lang: String = "nara"
val vibes: String = "modern"
print(lang ++ " has serious " ++ vibes ++ " vibes")