functions.step

goals do
  goal "Create a function"
  goal "Call a function"
end

step do
  message 'Create a new file called area.rb'
  type_in_file 'area.rb', <<-'CONTENTS'
def 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 #{circle_area(radius)}"
  CONTENTS
  console 'ruby area.rb'
  message 'When prompted, type in a radius for your circle.'
end

explanation do
  message "As your programs get more and more complicated, you'll want to group code into **functions** that can be called over and over again."
  message "A **function** begins with **def**, followed by the function name. Next comes any **variables** it takes, followed by the actual body of the function. Lastly, function definitions are finished with the **end** keyword."
  message "Pedantic Programmers might want to tell you that Ruby doesn't technically have **functions**, and everything in ruby is really a **method**. It is appropriate to slap these people."
end

next_step 'objects'