First implementation for 'const' variables
A variable can be declared const, which means it cannot be assigned to, with the syntax 'local <const> name = exp'.
This commit is contained in:
@@ -3,10 +3,10 @@
|
||||
|
||||
print("testing numbers and math lib")
|
||||
|
||||
local minint = math.mininteger
|
||||
local maxint = math.maxinteger
|
||||
local <const> minint = math.mininteger
|
||||
local <const> maxint = math.maxinteger
|
||||
|
||||
local intbits = math.floor(math.log(maxint, 2) + 0.5) + 1
|
||||
local <const> intbits = math.floor(math.log(maxint, 2) + 0.5) + 1
|
||||
assert((1 << intbits) == 0)
|
||||
|
||||
assert(minint == 1 << (intbits - 1))
|
||||
|
||||
Reference in New Issue
Block a user