Divisible by 2


#1

aparently the computer doesn't think that 2 is divisible by 2


Why is this?


#2

if(isEven % 2) {

}

No, I'm pretty sure most functions aren't divisible by 2.


#3

because isEven is the functionname, you should use the function parameter:

if(number % 2)

you might want to compare the result with zero, you don't have to, but if you don't, realize that 1 is considered true, and zero considered false (inside a if statement)(we are talking about the remainder here)


#4

thank you sarcasm I have figured that out already...