Page 1 of 1

Inc(crement) and Dec(crement) User Subs

Posted: Wed Sep 01, 2021 8:09 pm
by Electroguard
This simple pair of user subs avoids the need to keep repeating the variable names twice each time they are incremented or decremented.
Usage is INC variable_name (instead of variable_name = variable_name + 1) and DEC variable_name

Code: [Local Link Removed for Guests]

sub inc( it )
it = it + 1
end sub

sub dec( it )
it = it - 1
end sub
I've not had any reserved words conflict with Annex32 1.43.5 but it's easy enough to slightly rename them to eg: incR and decR if preferred.