Debian Codegraph @

ex28.sh

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2
3 LIMIT=19 # Upper limit
4
5 echoscip-shell system . . echo.
6 echoscip-shell system . . echo. "Printing Numbers 1 through 20 (but not 3 and 11)."
7
8 a=0
9
10 while [scip-shell system . . `[`. $a -le "$LIMIT" ]
11 do
12 a=$(($a+1))
13
14 if [scip-shell system . . `[`. "$a" -eq 3 ] || [scip-shell system . . `[`. "$a" -eq 11 ] # Excludes 3 and 11.
15 then
16 continue # Skip rest of this particular loop iteration.
17 fi
18
19 echoscip-shell system . . echo. -n "$a " # This will not execute for 3 and 11.
20 done
21
22 # Exercise:
23 # Why does the loop print up to 20?
24
25 echoscip-shell system . . echo.; echoscip-shell system . . echo.
26
27 echoscip-shell system . . echo. Printing Numbers 1 through 20, but something happens after 2.
28
29 ##################################################################
30
31 # Same loop, but substituting 'break' for 'continue'.
32
33 a=0
34
35 while [scip-shell system . . `[`. "$a" -le "$LIMIT" ]
36 do
37 a=$(($a+1))
38
39 if [scip-shell system . . `[`. "$a" -gt 2 ]
40 then
41 break # Skip entire rest of loop.
42 fi
43
44 echoscip-shell system . . echo. -n "$a "
45 done
46
47 echoscip-shell system . . echo.; echoscip-shell system . . echo.; echoscip-shell system . . echo.
48
49 exit 0