Functions
Goals
Step 1
Type this in the file area.rb:def calculate_circle_area(radius) Math::PI * (radius ** 2) end print "What is the radius of your circle? > " radius = gets.to_i puts "Your circle has an area of #{calculate_circle_area(radius)}"
Step 2
Type this in the terminal:ruby area.rb
Step 3
Type this in irb:def backwards( phrase ) phrase.reverse endType this in irb:backwards 'Hello'
Step 4
Type this in irb:mirror = backwards 'Hello'
Explicación
Next Step:
Go on to Classes