From 958dfe51fd8f325b95108672483b691aacd1aa6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind?= Date: Sat, 23 Apr 2022 23:07:38 +0200 Subject: [PATCH] added while in a while with some continue tests --- .../vsl_programs/ps6-codegen2/while_test.vsl | 52 ++++++++++++++----- 1 file changed, 39 insertions(+), 13 deletions(-) diff --git a/exercises/06/vslc/vsl_programs/ps6-codegen2/while_test.vsl b/exercises/06/vslc/vsl_programs/ps6-codegen2/while_test.vsl index 5caa685..807eae3 100644 --- a/exercises/06/vslc/vsl_programs/ps6-codegen2/while_test.vsl +++ b/exercises/06/vslc/vsl_programs/ps6-codegen2/while_test.vsl @@ -5,8 +5,10 @@ func while_test () begin var a, b a := 20 - + b := test_while() + + print "Loops done in test_while:", b print a @@ -29,29 +31,53 @@ end func test_while() begin - var n, m + var n, m, loops_done - n := 4 - m := 21 + m := 10 + n := 5 - while n > 0 do + loops_done := 0 + + + while m > 0 do begin - n -= 1 - if n = 2 then - continue - - while m > 0 do + + if m = 7 then begin m -= 1 + print "Skipping loop 7" + continue + end + + n := 5 + while n > 0 do + begin + - if m = 10 then + if n = 3 then + begin + n -= 1 + print "-------Skip 3 in inner loop" continue + end - print n, m + + loops_done += 1 + print "loop:", loops_done, "Values:", m, n + n -= 1 end + if m = 5 then + begin + m -= 1 + print "<<<<<