Next to the increment (:++) and decrement (:--) operators (see stage 96), SharpBASIC supports the 'shortcut' assignment operators :+ (addition), :- (subtraction), :* (multiplication) and :/ (division).
dim a:int=5;
main do
a:+5; ' equivalent to "a = a + 5;"
print(a); ' 10
a:-3; ' equivalent to "a = a - 3;"
print(a); ' 7
a:*7; ' equivalent to "a = a * 7;"
print(a); ' 49
a:++; ' equivalent to less optimal "a:+1" and "a = a + 1;"
print(a); ' 50
a:/10; ' equivalent to "a = a / 10;"
print(a); ' 5
end
Last edited by frank on Wed Mar 09, 2022 10:54 pm, edited 1 time in total.