Week4

278 views
259 views

Published on

UWE-Ruby Week 4 Class Slides

Published in: Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
278
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Week4

    1. 1. RubyWeek 4
    2. 2. HomeWork Review• Calculator• Collections• Inject
    3. 3. Numbers• FixNum• 1 is always 1! (unlike strings)• Floats (BigDecimal)• 4.2• 3.141516
    4. 4. Ranges• 1..5• 1...5• a..z• OddNumber.new(1)..OddNumber.new(5)
    5. 5. Symbols• :symbols_are_fun• A static name• Stored like numbers, named like strings!
    6. 6. Blocks• A method with no name!• Dynamic method definition
    7. 7. Block Syntax• {}• do • <code>• end
    8. 8. Blocks: Calling and Checking• yield• call• block_given?
    9. 9. Blocks with Parameters• yield(x)• call(x)• {|x|}• do |x| • <code>• end
    10. 10. Blocks Demo• Time My Code!• timer_spec.rb
    11. 11. Blocks Exercise• Do My Work!• worker_spec.rb
    12. 12. RegExp• Surprise Guest Lecturer!
    13. 13. HomeWork• Will be posted after class to the homework folder.• questions.txt• something_spec.rb

    ×