Ruby - Functional Patterns in Ruby
What will be printed by this Ruby code?
def to_str(x)
"Number: #{x}"
end
result = 5 |> to_str
puts resultWhat will be printed by this Ruby code?
def to_str(x)
"Number: #{x}"
end
result = 5 |> to_str
puts resultto_str methodto_str, which returns the string "Number: 5".puts outputs the string "Number: 5" exactly.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions