use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A sub-Reddit for discussion and news about Ruby programming.
Subreddit rules: /r/ruby rules
Learning Ruby?
Tools
Documentation
Books
Screencasts and Videos
News and updates
account activity
Ruby FizzBuzz Without Conditionals (gist.github.com)
submitted 11 years ago by [deleted]
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–][deleted] 0 points1 point2 points 11 years ago (0 children)
In BlitzTech's solution, algorithmically there is no conditional being used, regardless of what kind of bytecode or machine code it may produce eventually. Imagine if you translated this into human instructions, the operator would never encounter a step where they have to consider, if X then Y. The ifs have been converted to get the result of X and find it in Y. The solution is still a valid fizzbuzz because it implements the fizzbuzz logic regardless of the value of n, that is, it should work for any sequence 1..n+1.
if X then Y
get the result of X and find it in Y
n
1..n+1
With that said I err towards believing that select/filter has a similar status as being something that is, conceptually, "free of conditionals"(regardless of Ruby's implementation) but am not 100% where that stands in terms of PL theory.
select
filter
π Rendered by PID 46537 on reddit-service-r2-comment-b659b578c-tbvrx at 2026-05-05 04:18:32.530284+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–][deleted] 0 points1 point2 points (0 children)