TheIronYard--Orlando / ROR--2015--SPRING

Resources and homework for the Ruby on Rails cohort at @TheIronYard--Orlando for Spring 2015
Creative Commons Zero v1.0 Universal
6 stars 7 forks source link

02 -- High Functioning -- J. Spencer Hopkins #20

Closed jspencerhopkins closed 9 years ago

jspencerhopkins commented 9 years ago

Tasks

///////////////////////////////////////////////////////////////////

02 -- High Functioning

Description

That git is a real shot in the tucchus, isn't it? We'll play with that some more.

Today's big new things were functions and methods. A function is just a way to manipulate data. A method is a function that is attached to an object of some kind, like a number or a string or what have you. The data that gets manipulated by a function has to be given to it as one or more arguments. A method can have arguments as well, and it can access some of the data in its object as well.

Inside a function or method you can have other functions and methods, and data types. You can also have control structures, like if and else and while and until, and comparisons like <, >, or == (which is not the same as =), as well as logical operators like && and ||. That's about it.

For today's assignment, you will write a function that takes the English word for a number and turns it into an actual number. For example:

terrible_method_name("one") #=> 1
terrible_method_name("twelve") #=> 12

Your function should (a) have a better name than that, and (b) work for any integer up to at least 100. 1_000_000_000 would be better.

Start by writing expectations for some return values given some inputs. Then write out in English the rules for how numbers are named. Then translate your English into Ruby. Include some expectations in your file so you know it works. Save your work in a file called _some_expressivename.rb.

Objectives

Learning Objectives

After completing this assignment, you will have a better understanding of some aspects of git:

You will also know a lot more about Ruby:

After completing this assignment, you will be able to:

jspencerhopkins commented 9 years ago

https://github.com/jspencerhopkins/TIY-Assignments/wiki

jspencerhopkins commented 9 years ago

Pull request @ 8:15am 01.07.15

Peterortiz82 commented 9 years ago

:thumbsup: