# Literals val number = 85; #TODO: Decide on default integer type val number = 85.0; # f64 is the default float type val number: u16 = 27; # If you want more control over memory usage you can specify a integer type val number: u16 = 27u16; val number: u16 = 0x1B; val number: u16 = 0x1Bu16; val number: BigInt = BigInt::from(73); #TODO: naming val number: BigFloat = BigFloat::from(73); #TODO: naming val chars: char = ' '; val strings: String = "Normal string"; val strings: String = "Formated strings ${number}"; val strings: String = """String literals"""; val regex: Regex = /[0-9A-F]/; val list: List = [1, 2, 3, 2]; val sets: Set = {1, 2, 3, 2}; val maps = { "foo": 48, "bar": 97, }; val maps: Map = { "foo": 48, "bar": 97, }; # `value?` Can be used to bubble up an Option or Result # `value!` Can be used to panic on None or Error maps["foo"] # Option maps["foo"]! # 48 maps["foo"]? # 48 - Caller of function is responsible for None case maps.keys() # ["foo", "bar"] maps.values() # [48, 97] # Spreading val lhs = [1, 2, 3]; val rhs = [4, 5, 6]; val combined_list = [..lhs, ..rhs, 2, 4, 6]; val combined_sets = {..lhs, ..rhs, 2, 4, 6};