Showing posts with label Conditional Structure. Show all posts
Showing posts with label Conditional Structure. Show all posts

FOR loop syntax

FOR x = 1 TO 10
y = x
ENDFOR

DO..WHILE loop syntax

DO WHILE x <= 10
y = x
x = x + 1
ENDDO

DO CASE...ENDCASE syntax

DO CASE
CASE x = 1
y = 1

CASE x = 2
y = 2

CASE x = 3
y = 3

OTHERWISE
y = 0

ENDCASE

IF..ELSE syntax

IF x > y
* Your code come hereELSE
* Your code come here
ENDIF


Another form of IF..ELSE statement in Visual Foxpro is the IIF (,,) function. The first parameter is the expression you want to evaluate, the second parameter is the code to execute if the first parameter is true. The third parameter will be executed if the first parameter is evaluated as false.IIF (x > y, x=1, y=1)