Skip to content
Narta Xaymar Dirks edited this page Oct 29, 2026 · 2 revisions

Blitz3DBlitzPlusBlitzBasic

Int

Int(value)
Int:Int32(value)

Description

Converts a number or a text to an integer. A float is rounded to the nearest whole number, with halves going to the even one, so Int(2.5) is 2 and Int(3.5) is 4. A text is read from its start and ends at the first character that is not part of a number, which gives 0 when the text does not start with one. A text can also start with $ or 0x for hexadecimal digits and % or 0b for binary digits, so Int("$FF") is 255, and Int("-0b101") is -5. Those are bit patterns: too many digits wrap around, so Int("$FFFFFFFF") is -1, and a prefix without digits is 0.

Differences

  • The originals read a text with atoi, so Int("$FF") and Int("0x10") are 0 there. BlitzLLVM reads $, 0x, % and 0b numbers in texts the way source code does.

Examples

Print Int(3.5)
Print Int(2.5)
Print Int(-1.2)
Print Int("42 apples")
Print Int("$FF")
Print Int("0b101")
4
2
-1
42
255
5

Related Commands

Half 〔BlitzLLVM〕, Handle, Long 〔BlitzLLVM〕, UInt 〔BlitzLLVM〕

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally