PDA

View Full Version : Else in case statement


Dave Byron
30 Aug 06, 08:29 AM
In Piced I see there is no "else" in the case statement (like MS) so you can not have somthing like this;

case operator of
'*' : result:= number1 * number2;
'/' : result:= number1 / number2;
'+' : result:= number1 + number2;
'-' : result:= number1 - number2;
Else : result;
end;

Whats the best way of stopping the run time errors other than range checking before the case statement.

dave

Darren
30 Aug 06, 10:58 AM
Adding an else clause is in our to do list (#7076).

We are looking at removing the run time error for invalid cases, but currently you need to do a range check unfortunately.

[IL]NewGen
02 Sep 08, 02:22 PM
Yay !

if <condition> then
begin
<Task or condition then>
end
else
begin
<Task or condition then>
end;
:D