int
A whole number.
The number can be negative, zero, or positive. As Typst uses 64 bits to
store integers, integers cannot be smaller than -9223372036854775808
or
larger than 9223372036854775807
.
The number can also be specified as hexadecimal, octal, or binary by
starting it with a zero followed by either x
, o
, or b
.
You can convert a value to an integer with this type's constructor.
Example
#(1 + 2) \
#(2 - 5) \
#(3 + 4 < 8)
#0xff \
#0o10 \
#0b1001
构造函数
如果类型具有构造函数,可以像函数一样调用它来创建一个该类型的值。
如果类型具有构造函数,可以像函数一样调用它来创建一个该类型的值。
Converts a value to an integer.
- Booleans are converted to
0
or1
. - Floats are floored to the next 64-bit integer.
- Strings are parsed in base 10.
#int(false) \
#int(true) \
#int(2.7) \
#(int("27") + int("4"))
value
The value that should be converted to an integer.