Complete the code to print 'Hello, Ruby!' to the console.
puts [1]The puts method prints the string to the console. The string must be in quotes.
Complete the code to define a method named 'greet' that takes a name and prints a greeting.
def greet(name) puts "Hello, #{ [1] }!" end
The method parameter name is used inside the string to greet the person.
Fix the error in the code to correctly add two numbers and print the result.
a = 5 b = 10 puts a [1] b
The plus sign + adds two numbers together in Ruby.
Fill both blanks to create a hash with keys as symbols and values as strings.
person = { [1]: "Alice", [2]: "Developer" }Symbols like :name and :job are used as keys in Ruby hashes.
Fill all three blanks to create an array of numbers, select only even numbers, and print them.
numbers = [[1], [2], [3]] even_numbers = numbers.select { |n| n.even? } puts even_numbers
even? method to filter.The array contains numbers 2, 4, and 6. The select method filters even numbers using even?.
