Links are not active on this page.
 CASE Statements

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
 CopyCode imageCopy Code
DO CASE
 CASE n = 0
  ? 'Zero'
 CASE n > 0
  ? 'Pos'
 OTHERWISE
  ? 'Neg'
ENDCASE
 CopyCode imageCopy Code
Select Case n
 Case 0
  Print 'Zero'
 Case Is > 0
  Print 'Pos'
 Case Else
  Print 'Neg'
End Select
Pascal C/C++
 CopyCode imageCopy Code
case n of
 0: writeln("Zero");
 1: writeln("One");
end
 CopyCode imageCopy Code
switch(n) {
 case 0:
  printf("Zero\n");
  break;
 case 1:
  printf("One\n");
  break;
 default:
  printf("?\n");}

Expand imageSee Also