Docs
Values and operators
Literal forms, operator precedence, equality, and copy behavior.
Literal forms
42 0xff 0b1010 1_000 ; integers
3.14 1e-3 ; floats
<i32> 42 <f32> 3.5 ; explicit width
| _ ; true, false
b'raw' b"rich\n" ; bytes
p'/tmp/file' ; locator (absolute)
p'home/user' ; locator (relative)
p"http://xo.run" ; locator (URI)
250ms 5s 2m ; duration
Integers default to i64 and floats to f64. Width tags are prefix-only and support i32, i64, f32, and f64. Numeric kinds and explicit widths do not mix implicitly. A locator is one kind: path.class reads the stored text and reports 0 relative, 1 absolute, or 2 URI when a scheme is followed by ://. There is no path normalize on the stored payload.
Operators and precedence
-x !ready
a * b a / b a % b
a + b a - b
lo..hi
a == b a != b a === b a !== b
a < b a <= b a > b a >= b
left && right
left || right
Precedence runs from primary expressions to unary operators, multiplication/division/remainder, addition/subtraction, ranges, comparisons, &&, then ||. Parentheses override that order. Integer division truncates toward zero; float division remains fractional.
Deep and identity equality
== and != compare content recursively. For structs and lists, === and !== ask whether both names refer to the same object. Identity and deep equality are the same for value kinds such as numbers and strings.
/ std/io
/ std/str
$ a = [1, 2]
$ b = [1, 2]
$ alias = a
io.print(str.from_int(a == b))
io.print(str.from_int(a === b))
io.print(str.from_int(a === alias))
Copy behavior
Assignment, rebinding, and function calls always copy the binding. Named and anonymous structs and lists are references, so the copied binding shares one object. Numbers, booleans, strings, bytes, locators, durations, ranges, and function values copy their value. Reclamation of managed values is a separate topic; see /docs/memory.