what does this line mean z = (++b+—a)%5
```
var a = 3
var b = 2
z = (++b+—a)%5
document.write(z)
19 Replies
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
++b = 3
--a = 2
b + a = 5
5 % 5 = 0
so you can increment or decrement like that?
usually its b++ or a—
but you can ++b instead?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
- -
sry its suppose to be - -
++variable increments the variable, returning the new value.
variable++ increments the variable, but returns the old value.
so ++ variable means a = 3 is now a = 4
yep
but variable ++ means a = 3 is still a = 3?
yes, but next time it is 4
so after the operation
so would there be an operation like this?
z = (b ++ + a- -)
it could be, but as said before, don't do it, it is just not readable
o
i saw it in a quiz
thought i ask to know
there should not be spaces tho
ya i just wanted to make that clearer
lol
okay
thanks for the help
np
!close