RosettaCodeData/Task/Higher-order-functions/Ring/higher-order-functions.ring
2023-07-01 13:44:08 -04:00

18 lines
349 B
Text

# Project : Higher-order functions
docalcs(1,10,"squares",:square)
docalcs(1,10,"cubes",:cube)
func square(n)
return n * n
func cube(n)
return n * n * n
func docalcs(from2,upto,title,func2)
see title + " -> " + nl
for i = from2 to upto
x = call func2(i)
see x + nl
next
see nl