if statements | SoloLearn: Learn to code for FREE!

+1

if statements

when I use the if statement like this: iiS = 2 if iiS = 2: print ('IHaveProblem') I get an error and I dont know why... It says the = isnt part of the syntax... but it is right? So if you know what Im doing wrong please reply...

3/25/2017 5:11:48 PM

privrax.

7 Answers

New Answer

+9

iiS = 2 if iiS ==2: print('IHaveProblem')

+8

@privrax, read meharban's comment.

+5

replace = with == in if clause = is an assignment operator, meanjng that it is used to assign values, and not to test values. == is a condition checker, and returns true if both the values before and aftee == are same.

+5

+1

It says its on the second line: 1. iiS = 2 2. if iiS = 2: ^ SyntaxError

+1

Thanks guys! Your awesome!

+1

It worked! :D