Create a name string variable.
name = 'harrison'
name.upcase
name.downcase
name.capitalize
Get user input.
name = gets.chomp
puts "hi my name is #{name}"
Change string to number data type.
num = "1"
num.to_i
=> 1
Other ways to manipulate strings.
puts "harrison"
print "harrison"
# output to terminal as string
"harrison " + "malone"
# concatenate a string
puts "my name is harrison\nmalone"
=> my name is harrison
malone
# non printing character, \n inserts line break in this case
We also briefly looked at math. Not the differences between integer and float division. The ** operator represents an exponent (to the power of).
1 + 1
# => 2
4 / 2
# => 2
5 / 2
# => 2
5 / 2.0
# => 2.5
2 ** 3
# => 8
To create a ruby comment you insert a hashtag # at the front of the line.
# this is a comment
The shortcut on macOS to do this is cmd /
.