Understanding Nested Iteration: a Key to Success in RB101

Understanding With an Example

Photo by Hafidh Satyanto on Unsplash

Modeling the example in code

Array Provided
Expected Output

Coding Strategy: Outsource to helper methods

1) To code it all in one place within a single method

2) To outsource functionality to helper methods

Building the main method

Main Method Framework

Building the helper method

Additional Details for Helper Method
Helper Method Framework
tally_coins! Helper Method Implementation

Testing the Helper Method

Independent Testing of the Helper Method

Plugging the Helper Method Into the Main Method

Main Method With Helper Method

Running the Code

Final Code

Putting It All Together

--

--

--

Launch School Student in Ruby Track

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

re:Invent Security re:Cap: Week 3

Harnessing the power of Tableau’s Metadata API with Python

QuAck in the Cloud

Progress Report:Week 1 Skaehub Bootcamp Experience

Identifying load patterns

The Art of Creative Coding and Resources to get Started

Getting Started with Kubernetes | Kubernetes CNIs and CNI Plug-ins

100 Days of Code 2017 — Week 3 Recap

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ryan DeJonghe

Ryan DeJonghe

Launch School Student in Ruby Track

More from Medium

A Journey to Understand Variable Scope

ActiveRecord in Ruby simplified

Phase 3: Getting to Know Ruby

Halfway There!

what doesn’t kill you makes you stronger lol