>
Appendix
About
This section is included to assist the students to perform the activities present in the book. It includes detailed steps that are to be performed by the students to complete and achieve the objectives of the book.
1. Writing and Running Ruby Programs
Activity 1.01: Generating Email Addresses Using Ruby
Solution
- Define and print the first name variable:
puts "Enter your first name: "
- Use the gets.chomp method to allow the user input to be stored in the variables:
first_name = gets.chomp
- Similarly, create a new variable for the last name of the user and print it. Also apply gets.chomp on the variable to store the input data:
puts "Enter your last name: "
last_name = gets.chomp
- Lastly, use string interpolation to combine the ...
Get The Ruby Workshop now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.