JavaScript Editor js editor     Web development 



Main Page

You can compare how case statements differ between Visual FoxPro and other programming languages. Only Pascal does not offer default values in case statements.

Visual FoxPro BASIC
В Copy Code
DO CASE
 CASE n = 0
  ? 'Zero'
 CASE n > 0
  ? 'Pos'
 OTHERWISE
  ? 'Neg'
ENDCASE
В Copy Code
Select Case n
 Case 0
  Print 'Zero'
 Case Is > 0
  Print 'Pos'
 Case Else
  Print 'Neg'
End Select

Pascal C/C++
В Copy Code
case n of
 0: writeln("Zero");
 1: writeln("One");
end
В Copy Code
switch(n) {
 case 0:
  printf("Zero\n");
  break;
 case 1:
  printf("One\n");
  break;
 default:
  printf("?\n");}

See Also



JavaScript Editor js editor     Web development