1..5:writeln('Blah');
6..10:writeln('blah2');
I was wondering if it is possible to then manipulate the number
specific to that range.
i.e.
1..5:writeln('Blah');
something:=number*10;
6..10:writeln('blah2');
something:=number*11;
Is this possible? Thank you for any help
Mark
Assuming that number is the variable being used in the case statement, yes,
this is a valid way to go. But why ask here? It's easy enough to try.
program testcase;
uses crt;
var
tst : byte;
begin
write('Enter a number 1-20');readln(tst);
case tst of
1..5 : begin
writeln; writeln('You choose a number between 1 and 5..');
writeln('I will be adding 4 to that number.');
inc(tst,4);
end;
6..10 : begin
writeln('You number is: ',tst);
writeln('I'll add 3 to that number?!');
inc(tst,3);
end;
end;
writeln('After all that you ended up with the number',tst);
readln;
end.
--
-Onic B.B.S. List - http://plain.solidbox.com/bbslist/ *under
construction*
-Simple B.B.S. - telnet://plain.solidbox.com