Skip to main content

Increment() Function

The material we've covered about arrays is unique, and you may not be sure of how to use this knowledge. In order to put everything you've learned together, we're going to write a storage subroutine for your myBASdatent routine. You just need to learn about one more simple function: Increment(). It takes a variable and increments (changes) its value, and also returns this value. The increment can be a positive or negative number.

Note:

The Increment() function changes the value of its first argument.

println "current value of a = ", a
println "incremented to ", increment(a)
println "incremented to ", increment(a)
println "incremented to ", increment(a,3)
println "decremented to ", increment(a,-2)
println "a = ", a
FeedbackOpens in a new tab