||Topic was automatically imported from the old Question2Answer platform.
i made a simple code
a =+ 1
why the result is always 1?
thank you very much (sorry for bad english)
a = +1
Which sets a equal to one. If you want to increase the value of a, use
a += 1
which is equivalent to
a = a + 1
thank you very much for your answer but it says
“invalid operants ‘nil’ and int in operator ‘+’”
DaletWolff | 2020-04-13 06:21
Oh, sorry I missed that first part. You never give
a a starting value, so how can 1 be added to it? Assign a an initial value.
kidscancode | 2020-04-13 06:23
i undertsand thank you very much
DaletWolff | 2020-04-13 06:30