I don't understand why is it an syntax error when I type the following else: can someone explain to me please. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I don't understand why is it an syntax error when I type the following else: can someone explain to me please.

11th Oct 2016, 12:42 PM
Lubabalo Duma
Lubabalo Duma - avatar
2 Answers
+ 2
if you tried to write else: WITHOUT an if: or for: or while: it would give a syntax error if: code-block-1 else: code-block-2 is correct but, else: code-block is wrong because there is no if statement prior to this however if you had a different problem please post your code
11th Oct 2016, 2:14 PM
Sunera
Sunera - avatar
0
thank you for the help Sunera
11th Oct 2016, 2:17 PM
Lubabalo Duma
Lubabalo Duma - avatar