Skip to content
Advertisement

Putting else statement in a loop [closed]

All I want to do is add an else statement at the end e.g else: print(‘Incorrect’) but I keep getting an error saying unexpected indent. Any help would be greatly appreciated.

JavaScript
JavaScript

Advertisement

Answer

(You cant use else without an if) and there cant be anyting after a return

You can check the length of ages before returning

if something is in there return

else you can print something

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement