Code Samples
The FoxPro language contains commands quite similar to other programming languages such as Basic. Loops include do, if, while, for, else commands in a usage easily understood by anyone familiar with other programming languages. Commands take the form of "command" and "endcommand"
Some basic syntax samples:
FOR i = 1 to 10 x = x + 6.5 ENDFOR IF i = 25 i = i + 1 ELSE i = i + 3 ENDIF x = 1 DO WHILE x < 50 x = x + 1 ENDDO x = 1 DO WHILE .T. x = x + 1 IF x < 50 LOOP ELSE EXIT ENDIF ENDDO nMonth = MONTH(DATE) DO CASE CASE nMonth <= 3 MESSAGEBOX("Q1") CASE nMonth <= 6 MESSAGEBOX("Q2") CASE nMonth <= 9 MESSAGEBOX("Q3") OTHERWISE MESSAGEBOX("Q4") ENDCASE FOR EACH oControl IN THISFORM.Controls MESSAGEBOX(oControl.Name) ENDFOR f = Factorial(10) FUNCTION Factorial(n) LOCAL i,r r = 1 FOR i = n TO 1 STEP -1 r = r * n ENDFOR RETURN r ENDFUNCHello World example:
MESSAGEBOX("Hello World")Read more about this topic: Visual FoxPro
Famous quotes containing the words code and/or samples:
“Faultless honesty is a sine qua non of business life. Not alone the honesty according to the moral code and the Bible. When I speak of honesty I refer to the small, hidden, evasive meannesses of our natures. I speak of the honesty of ourselves to ourselves.”
—Alice Foote MacDougall (18671945)
“Good government cannot be found on the bargain-counter. We have seen samples of bargain-counter government in the past when low tax rates were secured by increasing the bonded debt for current expenses or refusing to keep our institutions up to the standard in repairs, extensions, equipment, and accommodations. I refuse, and the Republican Party refuses, to endorse that method of sham and shoddy economy.”
—Calvin Coolidge (18721933)