fork download
  1. function Left(n)
  2. if n < 0 then
  3. Right(math.abs(n))
  4. else
  5. print ("go left " .. n .. " spaces")
  6. end
  7. end
  8.  
  9. function Right(n)
  10. if n < 0 then
  11. Left(math.abs(n))
  12. else
  13. print ("go right " .. n .. " spaces")
  14. end
  15. end
  16.  
  17. Left(1)
  18. Left(-10)
  19.  
  20. Right(2)
  21. Right(-20)
Success #stdin #stdout 0.02s 2496KB
stdin
Standard input is empty
stdout
go left 1 spaces
go right 10 spaces
go right 2 spaces
go left 20 spaces