Aracılığıyla paylaş


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

DO CASE
 CASE n = 0
  ? 'Zero'
 CASE n > 0
  ? 'Pos'
 OTHERWISE
  ? 'Neg'
ENDCASE
Select Case n
 Case 0
  Print 'Zero'
 Case Is > 0
  Print 'Pos'
 Case Else
  Print 'Neg'
End Select

Pascal

C/C++

case n of
 0: writeln("Zero");
 1: writeln("One");
end
switch(n) {
 case 0:
  printf("Zero\n");
  break;
 case 1:
  printf("One\n");
  break;
 default:
  printf("?\n");}

See Also

Reference

DO CASE ... ENDCASE Command

Visual FoxPro and Other Programming Languages