I am getting trouble to run IF statement

hey, it seems like i am having issue for IF statement after integrating it into this code

any help is much welcome thanks.

Hi @zaidzac95,

It’s pretty much what the first error message says. An if statement always needs a condition expression that evaluates to a boolean value. The if block gets entered only if the condition evaluates to true.

This is different from the for loop that your code has above the if statement. A for loop without any loop condition simply runs forever. An if statement without a condition has no such default behavior.

And BTW, there are two more error messages, however, the errors are easy to spot and fix. These are just a stray comma and a missing closing parenthesis, respectively.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.