Key Highlights
Learn the foundational elements of Ruby programming such as variable assignment, user input, conditionals including if and case statements, and looping constructs like while and for loops. Understand how to work with arrays, hashes, and methods to build interactive and structured Ruby programs.
We'll cover the following...
We'll cover the following...
Print out
Variable assignment
Read user input
puts "type 'Hi'" input = gets # => type "Hi" puts input # => "Hi\n" ## normally strip off the new line "\n" input = gets.chomp # => "Hi" ## read an integer print "Enter a number" num = gets.chomp.to_i
Getting input from user and converting it to an integer
Conditional
Two boolean values—true and false