Short

Category: Keywords

Syntax:

Short:Type()



Returns

Type



Summary

A whole number from -32768 to 32767, in two bytes

Short is a whole-number type that takes two bytes of memory and holds -32768 to 32767. A value outside that range wraps round: 32768 is stored as -32768 and 40000 as -25536.

Mostly used for arrays, where it takes half the memory of an Int array: 16-bit sound samples (audQueueStream takes a Short array), height maps, tile maps. In sums it acts like an Int. Use ToInt to put an element into an Int variable.

View detailed documentation online



Example
Global samples:Short[4410]              ; 0.05 s of stereo sound at 44.1 kHz

Local i:Int
For i = 0 To 2204
    samples[i * 2] = 8000               ; left
    samples[i * 2 + 1] = -8000          ; right
Next

BambooBasic © 2026 Michael Denathorn