Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- **Agenda Iterators & Blocks**
- #Bad Git commits & Good Git Commits from Andre
- #Intro
- #Recap
- - puts and console
- - Arrays
- - CRUD arrays
- - Range
- - .. ...
- #Iterators .each
- - .each iterate over musicians display "Hello #{musican}"
- #Iterators .map
- - [] -> []
- - .upcase musicans, save to new array
- 2nd part
- - .map to make array with first name of musicians
- #Iteratorgit .conut
- - # [] -> integer
- - returns integer of sum of condition == true
- #Iterator .select & reject
- - # [] -> []
- - returns new array where condition == true
- ##!! do not return inside the iterators!!##
- ## Your job is now to search for new iterators for you excercises
- ## Search inside class of arrays in ruby docs
- ## Search inside enumerable - any
- #Blocks
- - Block is just an argument to a method
- - run code for method
- - Block returns something
- #Yield
- - Yield will run a block of code passed as an argument
- - Yield creates an extra "parameter" for a mathod, that will take the block as the argument. for the created parameter.
- - Implement bad Timer
- - Implement time with yield
- - Implement yield_greet.rb
- ##Files:
- - Recaps: recap_arrays.rb & recap_range.rb
- - .each iterator_each.rb
- - .map iterator_map.rb
- - .map iterator_first_name_map.rb
- - .count iterator_count.rb
- - .select iterator_select.rb
- - .yield yield_timer.rb &
- - .yield yield_greet.rb
Add Comment
Please, Sign In to add comment