"For" Loop


The "For" loop is used to perform a group of commands repeatedly. Unlike "While" which performs the commands until a certain condition is met, "For" repeats the commands a predesignated number of times. The specified variable is incremented by +1 unless otherwse specified.

Example, say you wanted to calculate the first 10 terms of the sequence 3k-2. Begin with k=1 and end with k=10.

For(K, 1,10)

Disp 3k-2

End

If you wanted to see every other term, define the increment as 2.

RETURN to pgrmSIERPINS

RETURN to General Commands