Complete the code to print a greeting message using a conventional Ruby method.
def greet puts [1] end greet
In Ruby, puts prints a string with a newline. The string must be in quotes.
Complete the code to define a class with a conventional Ruby naming style.
class [1] def initialize(name) @name = name end end
Ruby classes use CamelCase starting with a capital letter by convention.
Fix the error in the method name to follow Ruby conventions.
def [1](age) puts "Age is #{age}" end
Ruby method names use snake_case with lowercase letters and underscores.
Fill both blanks to create a hash with symbol keys using Ruby conventions.
person = { [1]: "Alice", [2]: 30 }Ruby uses symbols (starting with :) as keys in hashes by convention.
Fill all three blanks to write a conventional Ruby loop that prints numbers 1 to 3.
3.times do |[1]| puts [2] + [3] end
The block variable i counts from 0, so adding 1 prints numbers 1 to 3.
