Code snippets as I work through Chris Pine's Lear to Program, 2nd edition
Chapter 02 - Numbers
-
Introduction to Simple Arithmetics
-
Integers and Floats
Chapter 05 - Mixing It Up
-
Introduction to Casting / Conversions
-
User Input with gets and chomp
Chapter 06 - More About Methods
-
Introduction to String Methods
-
The Modulo Operator
-
Random Numbers and the rand Function
-
Introduction to Modules
Chapter 07 - Flow Control
- Branching, Looping, and Logic
Chapter 08 - Arrays and Iterators
- Introduction to Arrays, Array Methods, and Iteration
Chapter 09 - Writing Your Own Methods
-
Defining Methods
-
Method Parameters
-
Variable Scope
-
Return Values
Chapter 10 - Recursion
-
Introduction to Recursion
-
Creating a Sorting Algorithm
-
Re-implementing Sort to be Case Insensitive
Chapter 11 - Saving and Loading
-
Introduction to YAML
-
String Interpolation
-
Ruby IO Features
Chapter 12 - New Classes of Objects
-
Introduction to the Time Class
-
Introduction to Hashes
-
Introduction to Ranges
Chapter 13 - Creating New Classes, Changing Existing Ones
-
Creating a New Class
-
Instance Variables vs. Class Variables
-
The Initialization Process in Ruby
-
Adding a Method to an Existing Class
Chapter 14 - Blocks and Procs
-
Introduction to Blocks
-
Introduction to Procs
-
Methods that Take Blocks