ID:269304
 
for(var/a=1 to 12)
if(a%6==0) //I had to do that or no workie :(
world<<"Hi there."

if I do: if(!a%6), it doesn't come out true. :( If I do: if(a%6==0), it comes out true. What's going on?
Hell Ramen wrote:
if I do: if(!a%6), it doesn't come out true. :( If I do: if(a%6==0), it comes out true. What's going on?

It's an order of operations issue: the ! operator has a higher precedence than the % operator, meaning that in if(!a % 6), it evaluates if((!a) % 6). Checking for if(!(a % 6)) would work the way you want it to. =)

if(!(a % 6)) //works
if(!a % 6) //works differently than you may expect because of OO (Order of Operations)
In response to Wizkidd0123
Oohhh, thanks Wizzie. :d
I'm good at math with paranthesis, but not DM stuff like that. :p
In response to Hell Ramen
Tsk tsk...and that's pretty basic math too.

Absolute Zer0
In response to Absolute Zer0
Absolute Zer0 wrote:
Tsk tsk...and that's pretty basic math too.

Absolute Zer0

That's why I'm good at it. :p