Added more debug vsl
This commit is contained in:
@@ -28,4 +28,6 @@ func main() begin
|
||||
if my_func(1, 2, 3, 5, 8, 13, 21, 34) > 3 then begin
|
||||
print "True!"
|
||||
end
|
||||
|
||||
return 0
|
||||
end
|
||||
57
exercises/06/vslc/vsl_programs/ps3-simplify/while_test.vsl
Normal file
57
exercises/06/vslc/vsl_programs/ps3-simplify/while_test.vsl
Normal file
@@ -0,0 +1,57 @@
|
||||
// This program is a simple test of while loops, counting down from 19 to 0
|
||||
// and skipping 10 (if continue is implemented)
|
||||
|
||||
func while_test ()
|
||||
begin
|
||||
var a, b
|
||||
a := 20
|
||||
|
||||
b := test_while()
|
||||
|
||||
print a
|
||||
|
||||
|
||||
if a > 0 then print "foobar"
|
||||
while a > 0 do
|
||||
begin
|
||||
if a = 10 then
|
||||
begin
|
||||
a -= 1
|
||||
print "Skip..."
|
||||
continue
|
||||
end
|
||||
else
|
||||
a -= 1
|
||||
print a
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
func test_while()
|
||||
begin
|
||||
var n, m
|
||||
|
||||
n := 4
|
||||
m := 21
|
||||
|
||||
while n > 0 do
|
||||
begin
|
||||
n -= 1
|
||||
if n = 2 then
|
||||
continue
|
||||
|
||||
while m > 0 do
|
||||
begin
|
||||
m -= 1
|
||||
|
||||
if m = 10 then
|
||||
continue
|
||||
|
||||
print n, m
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
return 0
|
||||
end
|
||||
Reference in New Issue
Block a user