Ruby - Functional Patterns in Ruby
What is the output of the following Ruby code?
def square(x) x * x end def increment(x) x + 1 end result = 3 |> square |> increment puts result
What is the output of the following Ruby code?
def square(x) x * x end def increment(x) x + 1 end result = 3 |> square |> increment puts result
square: 3 * 3 = 9.increment: 9 + 1 = 10.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions