Simple for Loop Tutorial

From Progzoo
Jump to: navigation, search

In this application we can draw bricks and half-brick.

Warming up

Bricks11.png

CommandMeaning
h(3)Draws 3 half bricks
r()Start a new row in front


The default program draws six lines of three bricks.

Draw six lines of five bricks.

[Font] [Default] [Show] [Resize] [History] [Profile]

Using the Control Variable i

Bricks12.png


Put 0 in the first row, 1 in the second row up to 5 in the last row.

[Font] [Default] [Show] [Resize] [History] [Profile]

Gaps

Bricks13.png

CommandMeaning
h()Draws a half brick
m()Leaves a half brick gap
r()Start a new row in front


Use bricks and misses.

[Font] [Default] [Show] [Resize] [History] [Profile]