- Primitives: built in data types:
string
,integer
,FixNum
,boolean
, andsymbol
- Variables: storage container for data
- Collections: two types:
array
(lists) andHash
(key/value pairs). Can hold any data - Methods: resuable behavior. Data can be passed in via parameters. A method can have a return value.
- Class: reusable behavior and data
- Statements: logic flow is done through statements, like
if
andcase
- Looping: looping is done with the
each
method on anarray
orHash
- Using the
puts
method, greet yourself by name - Put your name in a variable (and keep the greeting)
- Put your employee number in the greeting as well
- Create a list of your hobbies
- If you have more than 5 hobbies, the program should say that you have too much going on and that you need to get rid of something
- If you have no hobbies, the program should say that you need to learn something
- Create a method
comment_on_hobbies
that will contain the previous two steps - Create a method
greet
that greets you by name - If the name has
Ann
inside of it, the greeting should say "your name is a lot like the creator of this program!" (use a regular expression) - Create a
Person
class that contains aname
,employee_number
,hobbies
, and thecomment_on_hobbies
andgreet
methods - Make sure your code is properly commented
- Create the people who work in your office by name (as a
Hash
) - Have the user enter in a name, and greet them and comment on their hobbies
- In addition to the current greeting, when a hobby is 'cooking', comment "I like cooking too!". When the hobby is "mountain biking", "biking", or "rock climbing", say "I'm not as into those things"
- Write a method
original_employee?
where it returnstrue
if youremployee_number
is under20
.