注意:该中文文档为社区驱动的非官网文档,可能存在错译、漏译或过时等问题,请以官网文档 Documentation 为准,如发现错漏,也欢迎 您的贡献镜像)。Typst 非官方中文交流 QQ 群:793548390
Warning: the Chinese document is a community-driven non-official document, there may be mistranslation, omission or outdated problems, please refer to the official website documentation.
Typst 中文文档

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
Preview

构造函数
如果类型具有构造函数,可以像函数一样调用它来创建一个该类型的值。

Converts a value to an integer.

#int(false) \
#int(true) \
#int(2.7) \
#(int("27") + int("4"))
Preview

value
bool int float str
必需参数位置参数
位置参数按顺序传入,不带名称。

The value that should be converted to an integer.