[Oberon] CASE statement

August Karlstrom fusionfile at gmail.com
Fri Apr 9 08:31:57 CEST 2021


On 2021-04-09 00:31, Duke Normandin wrote:
> Is it possible to have execute a block of code - BEGIN .... END for one or more CASE alternatives? I'm trying to simulate the following C code:
> 
>   switch (c){
>      case '1':
>        printf("Enter a number/temperature to convert: ");
>        scanf("%f", &temp);
>        printf("Your input was %.1lf Fahrenheit\n", temp);
>        printf("That's %.1lf in Celsius\n", fahr2cels(temp));
>        break;

Yes, the grammar says

	Case = [CaseLabels {"," CaseLabels} ":" StatSeq].


-- August


More information about the Oberon mailing list