Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Soda challenge #3

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Soda challenge #3

wants to merge 4 commits into from

Conversation

dharinim
Copy link

No description provided.

Copy link

@pongo-pygmaeus pongo-pygmaeus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solid work. Keep it up. You demonstrate a strong understanding of the material.

if soda != nil
@cash += soda.price
@sodas.delete(soda)
end
end

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice addition to the class.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job with reusing the find_soda method

end

def find_soda(soda_brand)
@sodas.find{|soda| return soda if soda.brand == soda_brand}
end

def sell(soda_brand)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

end

def find_soda(soda_brand)
@sodas.find{|soda| return soda if soda.brand == soda_brand}
end

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be condensed to:

  @sodas.find{|soda| soda.brand == soda_brand}

The method find automatically returns the first match.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants