Skip to content

Latest commit

 

History

History
29 lines (20 loc) · 866 Bytes

questions.md

File metadata and controls

29 lines (20 loc) · 866 Bytes

Day 4 Questions

  1. In your own words, what is the purpose of a method?
  • The purpose of a method is to modify an instance of an attribute of a class
  1. Create a method named hello that will print "Sam I am".
def hello
  puts "Sam I am"
end

  1. Create a method named hello_someone that takes an argument of name and prints "#{name} I am".
def hello_someone(name)
  puts "#{name} I am"
end

  1. How would you call or execute the method that you created above?
  • You would type hello_someone(name) on the command line
  • I believe you could call it with .hello_someone.
  1. What questions do you have about methods in Ruby?
  • Some methods are universal to ruby. Why do we need to think of methods as a way to change an attribute? Couldn't we just think of a method as a way to accomplish a task with our code?