File: loop.liq

package info (click to toggle)
liquidsoap 2.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 12,372 kB
  • sloc: ml: 71,806; javascript: 27,320; ansic: 398; xml: 114; sh: 99; lisp: 96; makefile: 26
file content (18 lines) | stat: -rw-r--r-- 404 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
def f() =
  n = ref(1)
  while n() < 10 do n := n() * 2 end
  test.equal(n(), 16)
  n = ref(0)
  for i = 0 to 10 do n := n() + i end
  test.equal(n(), 55)
  n = ref(0)
  for i = list.iterator([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) do n := n() + i end
  test.equal(n(), 55)
  s = ref("")
  for i = list.iterator(["a", "b", "c"]) do s := s() ^ i end
  test.equal(s(), "abc")

  test.pass()
end

test.check(f)