fork download
  1. x = '0'
  2. function start ()
  3. return function () end
  4. end
  5.  
  6. function set_x (v)
  7. x = v
  8. return function () end
  9. end
  10.  
  11. function if_x (v)
  12. if x == v then
  13. print ("x = ", v)
  14. return function (block) block[1]() end
  15. else
  16. print ("x != ", v)
  17. return function () end
  18. end
  19. end
  20.  
  21. -- DSL here
  22. start {
  23. set_x '10',
  24. if_x '10' { function() print ('x is 10') end },
  25. if_x '20' { function() print ('x is 20') end }
  26. }
Success #stdin #stdout 0s 2832KB
stdin
Standard input is empty
stdout
x = 	10
x is 10
x != 	20