If-Then-Else statement error near unexpected token 'Then'

Started by mahesh, Aug 12, 2023, 08:34 AM

Previous topic - Next topic

mahesh

Hi everyone. I'm currently trying to learn programming right now for a class, but I'm kind of stumped. I started the course late and my professor unfortunately did not provide many resources. I am not here to get answers for my homework, but I'm here to figure out how to do things and learn from my mistakes. Please don't get the wrong idea.

This is currently what I have:
If speed >= 24 OR speed <= 56; then
Display "Speed is normal"
else
Display "Speed is abnormal"
end if

And this is the error that pops up:

line 1: syntax error near unexpected token `then'
line 1: `If speed >= 24 OR speed <= 56; then'


The original question in the textbook was:

Design an If-Then-Else statement (or a flowchart with a dual alternative decision structure) that displays "Speed is normal" if the speed variable is within therange of 24 to 56. If speed holds a value outside this range, display "Speed is abnormal."