TDT4205/exercises/06/vslc/vsl_programs/ps6-codegen2/while_test.vsl

23 lines
435 B
Plaintext
Raw Normal View History

2022-04-10 15:55:56 +02:00
// 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
a := 20
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