cannot convert from int to boolean

Hey Coders, can you tell me what's wrong here? I want to reset "a" when it reaches 100. Thanks!!!

Tagged:

Answers

  • edited July 2015 Answer ✓

    Change the if statement to this

    if (i == 0) {

    = is the assignment operator so in your if statement it assigns the value 100 to a and because the assignment paases the value on it attempts to convert the integer 100 to a boolean because the if statement expects a boolean expression.

    The == operator tests for equality.

  • Perfect! Thank you quark!

Sign In or Register to comment.