Skip to content

Commit 2cda8a2

Browse files
Update README.md
1 parent 7aa8f79 commit 2cda8a2

File tree

1 file changed

+45
-1
lines changed

1 file changed

+45
-1
lines changed

README.md

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ forever. Conditional loops are loops with
333333
specific conditions other than simple iteration
334334
just like in robot programming:
335335
repeat until color red, repeat until the
336-
distance is less than 50mm.
336+
distance is less than 50mm, etc.
337337

338338
The most common that we see in computer
339339
programming: the `for` loop,
@@ -379,6 +379,50 @@ int main() {
379379
}
380380
```
381381

382+
the result:
383+
```
384+
/tmp/phNY4lZU2A.o
385+
the `for` loop:
386+
iteration: 1 | Hello World.
387+
iteration: 2 | Hello World.
388+
iteration: 3 | Hello World.
389+
iteration: 4 | Hello World.
390+
iteration: 5 | Hello World.
391+
iteration: 6 | Hello World.
392+
iteration: 7 | Hello World.
393+
iteration: 8 | Hello World.
394+
iteration: 9 | Hello World.
395+
iteration: 10 | Hello World.
396+
------
397+
the `while` loop:
398+
iteration: 1 | Hello World.
399+
iteration: 2 | Hello World.
400+
iteration: 3 | Hello World.
401+
iteration: 4 | Hello World.
402+
iteration: 5 | Hello World.
403+
iteration: 6 | Hello World.
404+
iteration: 7 | Hello World.
405+
iteration: 8 | Hello World.
406+
iteration: 9 | Hello World.
407+
iteration: 10 | Hello World.
408+
------
409+
the `do while` loop:
410+
iteration: 1 | Hello World.
411+
iteration: 2 | Hello World.
412+
iteration: 3 | Hello World.
413+
iteration: 4 | Hello World.
414+
iteration: 5 | Hello World.
415+
iteration: 6 | Hello World.
416+
iteration: 7 | Hello World.
417+
iteration: 8 | Hello World.
418+
iteration: 9 | Hello World.
419+
iteration: 10 | Hello World.
420+
```
421+
422+
As you can see here, it's just printing the
423+
Hello World ten times, whether it's `for` loop,
424+
`while` loop or `do-while` loop.
425+
382426
## Functions
383427
A function is a group of statements (commands)
384428
that together perform a task.

0 commit comments

Comments
 (0)