/samples/closure/while1.ooc

http://github.com/nddrylliog/oc · Unknown · 13 lines · 10 code · 3 blank · 0 comment · 0 complexity · 1e5a0a6f2b85d1cba9bd07107f96b848 MD5 · raw file

  1. printf: extern func
  2. while0: func (cond: Func -> Bool, block: Func) {
  3. cond() ifTrue(||
  4. block()
  5. while0(cond, block)
  6. )
  7. }
  8. while0(|| 1, ||
  9. printf("%s\n", "Hi there!")
  10. )