tomo/test/integers.tm

59 lines
553 B
Plaintext
Raw Normal View History

2024-04-28 11:58:55 -07:00
func main():
2024-04-12 10:09:31 -07:00
>> 2 + 3
= 5
2024-02-23 10:34:40 -08:00
2024-04-12 10:09:31 -07:00
>> 2 * 3
= 6
2024-02-23 10:34:40 -08:00
2024-04-12 10:09:31 -07:00
>> 2 + 3 * 4
= 14
2024-02-23 10:34:40 -08:00
2024-04-12 10:09:31 -07:00
>> 2 * 3 + 4
= 10
2024-02-23 10:34:40 -08:00
2024-04-12 10:09:31 -07:00
>> 1i8 + 2i16
= 3_i16
2024-02-23 10:34:40 -08:00
2024-04-12 10:09:31 -07:00
>> 2 ^ 10
= 1024 : Num
2024-02-23 10:34:40 -08:00
2024-04-12 10:09:31 -07:00
>> 3 and 2
= 2
2024-02-23 10:34:40 -08:00
2024-04-12 10:09:31 -07:00
>> 3 or 4
= 7
2024-02-23 10:34:40 -08:00
2024-04-12 10:09:31 -07:00
>> 3 xor 2
= 1
2024-02-23 10:34:40 -08:00
2024-04-12 10:09:31 -07:00
nums := ""
2024-04-28 11:58:55 -07:00
for x in 5:
2024-04-12 10:09:31 -07:00
nums ++= "{x},"
>> nums
= "1,2,3,4,5,"
2024-02-23 10:36:16 -08:00
2024-04-12 10:09:31 -07:00
>> x := 123
>> x:format(digits=5)
= "00123"
>> x:hex()
= "0x7B"
>> x:octal()
= "0o173"
2024-04-12 10:09:31 -07:00
>> Int.random()
>> Int.min
= -9223372036854775808
>> Int.max
= 9223372036854775807
2024-04-12 10:09:31 -07:00
>> 123_i32:hex()
= "0x7B"
>> 123_i16:hex()
= "0x7B"
>> 123_i8:hex()
= "0x7B"
>> Int(2.1)
= 2 : Int