main :: (): int // Language has a bunch of standard builtin types: // Signed integer types s64val: S64 = 0 s32val: S32 = 0 s16val: S16 = 0 s8val : S8 = 0 intval: int = 0 // Unsigned integer types = U64, U32, U16, U8, u64val: U64 = 0 u32val: U32 = 0 u16val: U16 = 0 u8val : U8 = 0 // Floating point types = F64, F32 f64val: F64 = 0 f32val: F32 = 0 // String type = String string_val: String = "String type" cstring_val: *char = "CString type" assert(s64val == 0 && s32val == 0 && s16val == 0 && s8val == 0 && intval == 0 && u64val == 0 && u32val == 0 && u16val == 0 && u8val == 0 && f64val == 0 && f32val == 0) // @todo: Fix error here !! // assert(string_val[0] == 'S) //' assert(cstring_val[0] == 'C) //' // This is how we can assign variables // There is no need for prefixes, compiler figures // out the format by itself signed_variable: S32 = 10 unsigned_variable: U32 = 10 // We can also tell the compiler to infer the type this_is_s64_by_default := 10 this_is_f64_by_default := 10.1251 this_is_string_by_default := "Thing" // Reassigning values is exactly like in other languages this_is_s64_by_default = 20 this_is_string_by_default = "Other_Thing" this_is_f64_by_default = 15.1255 // @todo: Add type_of operator!!! // assert(type_of(this_is_string_by_default) == String) // assert(type_of(this_is_s64_by_default) == S64) // There are also constant bindings in the language. // You can bind all sorts of constants to names this way. INT_VALUE :: 10 FLOAT_VALUE :: 124.125 // For constants we can mix and match different types COMBINE_VALUE :: INT_VALUE + FLOAT_VALUE // When it comes to runtime variables it's a bit different // To do this we need a cast combining_types := this_is_s64_by_default->F64 + this_is_f64_by_default assert(signed_variable == 10 && unsigned_variable == 10) assert(INT_VALUE == 10) assert(FLOAT_VALUE == 124.125) assert(this_is_f64_by_default == 15.1255) assert(combining_types == 15.1255 + 20)