How to say: if the result is zero then the digit is zero otherwise it is 600

I am trying to use the if function to say if the result is zero then the digit is equals to zero otherwise it is 600 but its giving me a boolean error no matter what I try.

This is my code so far

  int result= mult%10;
  boolean b =boolean(result);
  int checkDigit;
  if (b=0){
    checkDigit=0;
  } else {
    checkDigit=600;
  }
 b = 0;
 if(checkDigit==600)b =600
1 Like

i dont understand, i had put the == but i was getting some boolean error

By saying boolean b, you’re saying you want b to be a boolean. You then say b = 0, meaning it’s expecting b, to be an int, it cannot be both.

Also equals boolean checks always use double ==

1 Like

oh okay i see, thank you so much!

2 Likes