Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby Ruby Objects and Classes Build a Bank Account Class Part 3: Keeping Our Balance

Eliza SJ
Eliza SJ
4,587 Points

What is the purpose of 'return balance' ? What is 'return' actually doing ?

What is the purpose of 'return balance' after the each loop?

What is return actually doing? Returning the information to the computer?

2 Answers

The return balance is returning the changes that were just made due to the transaction. so that anytime we add money or subtract money it reports that change.

Eliza SJ
Eliza SJ
4,587 Points

Thanks! Makes sense :) I figured it was a given that the transaction would have a return balance. It didn't occur to me that I'd have to restate it after the loop!