-
Notifications
You must be signed in to change notification settings - Fork 79
Working implementations besides the final BYE test. #78
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,3 +20,9 @@ PLATFORMS | |
|
|
||
| DEPENDENCIES | ||
| rspec (~> 3.0.0.beta2) | ||
|
|
||
| RUBY VERSION | ||
| ruby 2.0.0p648 | ||
|
|
||
| BUNDLED WITH | ||
| 1.15.4 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,19 @@ class SuperFizzBuzz | |
|
|
||
| def run(input) | ||
|
|
||
| #Implement your code here | ||
| if input % 3 == 0 && input % 5 == 0 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How could you solve this using ruby's .tap method? |
||
| return "FizzBuzz" | ||
| end | ||
|
|
||
| if input % 5 == 0 | ||
| return "Buzz" | ||
| end | ||
|
|
||
| if input % 3 == 0 | ||
| return "Fizz" | ||
| end | ||
|
|
||
| return input | ||
|
|
||
| end | ||
|
|
||
|
|
||
There was a problem hiding this comment.
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.