Ruby - Basics and Runtime
You want to quickly test a method in IRB that returns the square of a number. Which of these is the correct way to define and test it?
def name(params); body; end syntax. def square(x); x * x; end; square(4) follows this correctly.square(4) is correct. The other options have syntax errors or wrong Ruby style.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions