function_piping.ion 363 B

1234567891011121314151617181920212223242526272829303132
  1. fn square
  2. read x
  3. echo $(( x * x ))
  4. end
  5. echo 5 | square
  6. fn square x
  7. echo $(( x * x ))
  8. end
  9. square 5 | cat
  10. fn format_with pat
  11. read input
  12. echo $join(@split(input) $pat)
  13. end
  14. echo one two three four five | format_with "-"
  15. fn square
  16. read x
  17. echo $(( x * x ))
  18. end
  19. fn mult x
  20. read y
  21. echo $(( y * x ))
  22. end
  23. echo 5 | square | mult 3