here is the code
for i=1,#tbl do if not i%2==0 then spr(3,tbl[i],tbl[i+1]) end end |
Everything else in the code is fine, so i wont include it.
When run it says "attempt to perform arithmetic on a boolean value", and the error is in the if not line. Tell me why and what to do please.
P#43439 2017-08-19 18:06 ( Edited 2017-08-20 08:07)
This is because 'not' is a unary operator, like negation, and unary operators have very high precedence.
Consider what you'd expect if you wrote...
if -i%2==0 then |
If you know C/C++, treat 'not' like the '!' symbol, which is identical in behavior.
P#43456 2017-08-20 04:07 ( Edited 2017-08-20 08:09)
[Please log in to post a comment]