News:

Function Finder  Find all the functions within source code files

Main Menu

Array element incrementing?

Started by ken tankerous, October 09, 2005, 11:22:34 AM

Previous topic - Next topic

ken tankerous

How come this works:

PlayerScore(1) = PlayerScore(1) + 1

but this doesn't

Inc(PlayerScore(1))

According to the docs "Inc is shorthand for the expression Variable=Variable+1"

Thanks in advance
Ken

kevin

#1
 way back in 2005, the  INC was only designed to work on variables.


EDIT Modern versions of PlayBASIC  have replaced the INC operator with the math short cuts operators such as ++, += etc These can be used on any data type during an assignment. See -> WIP

 So you can use the ++ operator to replace INC,  

 EG..  So an expression like this

 PlayerScore(1) = PlayerScore(1) + 1

 becomes

 PlayerScore(1)++

 or you can also use += if you like.  

 PlayerScore(1)+=1   (add 1 to it )


 PlayerScore(1)+=20   (add 20 to it)