case do problem

Gregory Ewing greg.ewing at canterbury.ac.nz
Wed Mar 3 07:23:27 CET 2010


Alf P. Steinbach wrote:
> * Tracubik:
 >
>> iterations=0;
>> count=0;
>> REPEAT;
>>   iterations = iterations+1;
>>   ...
>>   IF (genericCondition) THEN count=count+1;
>>   ...
>>   CASE count OF:
>>     1: m = 1
>>         2: m = 10
>>         3: m = 100
> 
> Uhm, is this syntactically valid Pascal? As I recall, every Pascal 
> construct was delimited in some way.

I think it's okay. Pascal's control structures such as
if-then and while-do mostly take single statements and
didn't have an ending keyword. If you want multiple
statements in the body you have to put begin-end around
them.

Putting a semicolon after REPEAT is stylistically a
bit odd, but it's not wrong.

-- 
Greg



More information about the Python-list mailing list