Ruby - Methods
What will this Ruby method return when called with
calculate(3)?def calculate(x) return x * 2 if x > 5 x + 10 end
calculate(3)?def calculate(x) return x * 2 if x > 5 x + 10 end
x * 2 happens only if x > 5. Here, x is 3, so condition is false.x + 10, which is 3 + 10 = 13.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions