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

Working implementations besides the final BYE test. #78

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Working implementations besides the final BYE test. #78

wants to merge 1 commit into from

Conversation

robert-smith-07
Copy link

Not sure how to check for both the BYE SONNY message and exit function being called in the same test.

@jaybobo

…heck for both the message and exit function being called in the same test.
@@ -2,7 +2,19 @@ class SuperFizzBuzz

def run(input)

#Implement your code here
if input % 3 == 0 && input % 5 == 0
Copy link
Member

Choose a reason for hiding this comment

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

this can be combined in an if..elsif or case statement. that way you can avoid the explicit return statements.

you won't see explicit returns a lot in ruby except in the case of early returns.

  def fn
    return true if condition
    false
  end

Copy link
Member

Choose a reason for hiding this comment

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

How could you solve this using ruby's .tap method?
https://ruby-doc.org/core-2.4.2/Object.html#method-i-tap

end

# if input is UPPERCASE say one thing, if not, say another
if input == input.upcase
Copy link
Member

Choose a reason for hiding this comment

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

see my notes about fizzbuzz. you can clean this up quite a bit without using explicit returns.

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.

2 participants