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

**URL:** <https://discourse.processing.org/t/how-to-say-if-the-result-is-zero-then-the-digit-is-zero-otherwise-it-is-600/31180>\
**Category:** Coding Questions\
**Created:** [July 11, 2021, 7:55pm UTC](https://discourse.processing.org/t/how-to-say-if-the-result-is-zero-then-the-digit-is-zero-otherwise-it-is-600/31180 "2021-07-11T19:55:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tay](https://avatars.discourse-cdn.com/v4/letter/t/ecb155/32.png) [@Tay](https://discourse.processing.org/u/Tay)\
**Post date:** [July 11, 2021, 7:55pm UTC](https://discourse.processing.org/t/how-to-say-if-the-result-is-zero-then-the-digit-is-zero-otherwise-it-is-600/31180/1 "2021-07-11T19:55:07Z")

</div>

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

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

```

---

<div class="post-metadata">

**Author:** ![paulgoux](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Post date:** [July 11, 2021, 8:05pm UTC](https://discourse.processing.org/t/how-to-say-if-the-result-is-zero-then-the-digit-is-zero-otherwise-it-is-600/31180/2 "2021-07-11T20:05:46Z")

</div>

```auto
 b = 0;
 if(checkDigit==600)b =600

```

---

<div class="post-metadata">

**Author:** ![Tay](https://avatars.discourse-cdn.com/v4/letter/t/ecb155/32.png) [@Tay](https://discourse.processing.org/u/Tay)\
**Post date:** [July 11, 2021, 8:08pm UTC](https://discourse.processing.org/t/how-to-say-if-the-result-is-zero-then-the-digit-is-zero-otherwise-it-is-600/31180/3 "2021-07-11T20:08:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![paulgoux](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Post date:** [July 11, 2021, 8:36pm UTC](https://discourse.processing.org/t/how-to-say-if-the-result-is-zero-then-the-digit-is-zero-otherwise-it-is-600/31180/4 "2021-07-11T20:36:36Z")

</div>

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 `==`

---

<div class="post-metadata">

**Author:** ![Tay](https://avatars.discourse-cdn.com/v4/letter/t/ecb155/32.png) [@Tay](https://discourse.processing.org/u/Tay)\
**Post date:** [July 11, 2021, 8:53pm UTC](https://discourse.processing.org/t/how-to-say-if-the-result-is-zero-then-the-digit-is-zero-otherwise-it-is-600/31180/5 "2021-07-11T20:53:38Z")

</div>

oh okay i see, thank you so much!
