Ruby - Methods
Which of the following is the correct way to declare a method named
greet in Ruby?greet in Ruby?def method_name() and end with end. Parentheses are optional but allowed.def greet() puts "Hello" end, which is correct Ruby syntax. Options B and D use wrong keywords, and C misses end.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions