Why the mistake | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why the mistake

if hour < 7 {     print("Good Morning!")  } else if hour < 17 {     print("Good Aftermoon!") } else if hour < 20 {     print("Good Evening!")

30th Aug 2022, 3:03 PM
mehrzadbeginner
mehrzadbeginner - avatar
2 Answers
+ 1
Md20101389 There should be colon(:) after each condition like if hour < 7: There is elif in python not else if
30th Aug 2022, 3:04 PM
A͢J
A͢J - avatar
+ 1
Add a programming language name in post tags for context clarity sake. If it was Python, curly braces are not necessary - code indentation is. https://code.sololearn.com/W3uiji9X28C1/?ref=app
30th Aug 2022, 3:36 PM
Ipang