when you use := it means becomes or is therefore equal to and when you use += it means becomes itself plus whatever is next
code: |
So
var word : string := "" %declares it as nothing
word := word +"hello" %is the same as
word+=word
|
-= means becomes itself - something
code: |
var num : int
put "Enter a number: "..
get num
num -= 2
put "Your number minus 2 is equal to ", num %even though you got num you change it to num := num - 2
|
You were a little confused when you saidMr.Programmer wrote:
Ohhh. Then i guess var -= 22 is like saying ' var + var - 22 '?
If so then it makes sense.
And thank you very much.