def f(x, y) return x + y end puts f(2, 3) values = [3, 4] puts values puts f(values) # expected 7
The f function expects two parameters. What if I have the values in an array? Can I somehow tell Crystal to pass the content of the array to the function. (In Python this would be done by prefixing variable with a star: f(*values).