diff --git a/examples/for.ion b/examples/for.ion index 839eed46deb8d9f44a6c3f993e856b27ca490aea..e5df5c47860e5edb791e1d7b31bb6f5fd67ea2c8 100644 --- a/examples/for.ion +++ b/examples/for.ion @@ -21,3 +21,15 @@ end for i in 1{A{1,2},B{1,2}} echo $i end + +mkdir for_test +cd for_test +touch "a b c" +touch "d e f" +touch "g" +touch "h i" +for file in * + echo $file +end +cd .. +rm for_test -R diff --git a/examples/for.out b/examples/for.out index c73395cdd14bdae90cfd4104b1f182f6b2c807ad..aa2a732629dee25df6e12458f8079f0c7737c7b9 100644 --- a/examples/for.out +++ b/examples/for.out @@ -27,3 +27,7 @@ 1A2 1B1 1B2 +a b c +d e f +g +h i diff --git a/examples/let.ion b/examples/let.ion index 9ee875cc098351591445a58a801a1254992dcffb..69e31c85e08cb9b778ca4d47c74523120d6dd68f 100644 --- a/examples/let.ion +++ b/examples/let.ion @@ -1,17 +1,29 @@ let a = 5 echo $a + let a b = [10 $a] echo $a echo $b + let b a = [$a $b] echo $a echo $b + let a b c = 1 2 3 echo $a echo $b echo $c + let a b c = ["one two" "three four" "five six"] let a b c = [$c $a $b] echo $a echo $b echo $c + +let a = 1; +let a += 4 +echo $a +let a *= 5 +echo $a +let a /= 4 +echo $a diff --git a/examples/let.out b/examples/let.out index 55895815de777fa5dab4457f94eb72dd021a5857..25ada159fa4d5d44713a56c4a9aec21a6a81d480 100644 --- a/examples/let.out +++ b/examples/let.out @@ -9,3 +9,6 @@ five six one two three four +5 +25 +6.25 diff --git a/examples/while.ion b/examples/while.ion index 22707283d9241d9d25c3ba9adac8f990287a3dc1..d80353954d76db80515a73f6405b90cbbb3e6f0c 100644 --- a/examples/while.ion +++ b/examples/while.ion @@ -17,3 +17,16 @@ while test $a -lt 10 end let a += 1 end + +# Nested While Loops + +let outer_count = 1; +while test $outer_count -lt 4 + echo "outer loop #$outer_count" + let outer_count += 1 + let inner_count = 1 + while test $inner_count -lt 4 + echo " inner loop #$inner_count" + let inner_count += 1 + end +end diff --git a/examples/while.out b/examples/while.out index 3ee7080e62276f33c79eaa340467922751a4206a..e6cc4235186b5cff490925deb6a0f7f44b446b5e 100644 --- a/examples/while.out +++ b/examples/while.out @@ -16,3 +16,15 @@ found 5 7 8 9 +outer loop #1 + inner loop #1 + inner loop #2 + inner loop #3 +outer loop #2 + inner loop #1 + inner loop #2 + inner loop #3 +outer loop #3 + inner loop #1 + inner loop #2 + inner loop #3