Ruby - Methods
Fix the error in this Ruby method so it returns the sum of two numbers:
def add(a, b) a + b puts "Sum calculated" end
def add(a, b) a + b puts "Sum calculated" end
puts "Sum calculated", which returns nil, so method returns nil.puts or place it before a + b so the last expression is sum.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions