TDT4205/exercises/02/vslc/vsl_programs/ps2-parser/if_else.vsl

28 lines
542 B
Plaintext
Raw Normal View History

2022-02-13 17:40:20 +01:00
func main()
begin
2022-02-14 15:30:01 +01:00
var a, b, c, d, e
2022-02-13 17:40:20 +01:00
c := 1
a := 3
b := a + c // 4
d := a * 100 + 50
2022-02-14 15:30:01 +01:00
e := d + 100 * 2 + (50 + 3 * e)
2022-02-13 17:40:20 +01:00
print "a", a
print "b", b
print "c", c
print "d", d
2022-02-14 15:30:01 +01:00
print "e", e
2022-02-13 17:40:20 +01:00
if a = 14 then
print 1, "N", d / 5 + a, "RPR", a, "TERS "
else
print "COMP", c, "L", "ERS "
print b, "R", a, " "
if a < b then
if d > 42 then
print b, "W", d, "ME"
else
print "L", b, "M", c
// A dangling else, what could go wrong?
end