Question: I have a component with the following functions:

```
constructor(MyProps: Readonly<MyProps>){
    super(MyProps);
    this.state = {suppliers: [], supplierId:0, supplierName:''};
    this.addSupplier.bind(this);
  }

addSupplier(){
    const {supplierId} = this.state;
    alert('supplierId = ' + supplierId);
}

<Button onClick={this.addSupplier}>Add</Button>

```

State is initialized as expected b/c this.state.supplierId is bound and displayed as expected in an html input in the component on load. The onChange handler within the html input also calls setState to update state.supplierId as expected. However, when the addSupplier() button gets triggered, the following error occurs:

> 
> TypeError: Cannot read property 'supplierId' of undefined
> 
> 
> 

So for some reason, state is not available in this context. Any idea why this is?

Answer: 
You checked the opposite:

If it's true for every element of `db` does *not* divide `i`.

You need to switch the branches of your `if` logic:

```
if all(i % d == 0 for d in db):
    print(i, "is divisible by all elements of the list")
else:
    i += 1

```

Alternately:

```
if any(i % d != 0 for d in db):
    i += 1
else:
    print(...)

```

---

Note that this appears to look for the *lowest* integer divisible by every integer in `db`. You can do this a lot faster by more directly finding the LCM (least common multiple) of the list. Put that into your browser's search bar.
`if` is not a loop. It looks like you meant to use `while`.

As well, you have the logic reversed. Use `any` instead of `all`.

```
db = [3, 4, 5, 6, 7, 8]
i = 1
while any(i % d != 0 for d in db):
  i += 1

print(i)  # -> 840

```

*(I left out some info that [Prune](https://stackoverflow.com/users/4785185/prune) already covered in [their answer](https://stackoverflow.com/a/59567088/4518341).)*