Inc
Inc VariableToIncease, [ OptionalAmount ]
 
Parameters:

    VariableToIncease = The integer or floating point variable you wish to add one too.
    [ OptionalAmount ] = The amount to add to this variable. If not provided, Amount defaults to 1
Returns: NONE
 

The INC command gives us an easier way to add one to integer or float variables.





FACTS:


* Inc only works with Integer and Floating point variables.

* Inc is shorthand for the expression Variable=Variable+1

* Note: Inc does Not work with Arrays or Types.

* Note: PlayBASIC also support various math short Operators, such as ++ , and += which perform the same operations Inc, but can be used upon any data type.





Mini Tutorial:



  
  
; create integer variable called Counter and
; assign it starting value of ten
  Counter=10
  
; Display the value of the counter variable
  Print Counter
  
; Add one to the counter variable.
  Inc Counter
  
; Display the value of the counter variable
  Print Counter
  
  
; Add Ten to the counter variable.
  Inc Counter,10
  
; Display the value of the counter variable
  Print Counter
  
  Sync
  WaitKey
  
  


This example will output

  
  10
  11
  21
  



 
Related Info: Dec | Operators :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com