Top | Up (Operators) | < Previous (PAGE NAME) | Next (DEC) >
Adds a value to a variable. Works on numbers and strings.
INC number_variable [, amount]
INC string_variable$, string$
INC variable, amount
is a shorter way of writing variable = variable + amount
(similar to variable += amount
in other languages).
amount
is 1 if omitted.
When used on strings, INC
works the same as PUSH
(but slightly faster). Either way is more efficient than +
because they modify the string rather than making a copy.
X=13
INC X
PRINT X '14
S$="abc"
INC S$,"defg"
PRINT S$ 'abcdefg
Using INC on a string literal which was passed to a function no longer crashes. 1
Fixed bugs caused by using INC or DEC on a system variable.
1 SmileBoom, “Fixes in Ver. 3.2.0 (June 17, 2015)” http://smilebasic.com/en/debug/archive/ 2 SmileBoom, “Bug Fixes in Ver. 3.3.0 (April 26, 2016)” http://smilebasic.com/en/debug/archive/
Top | Up (Operators) | < Previous (PAGE NAME) | Next (DEC) >