Search
 
SCRIPT & CODE EXAMPLE
 

RUBY

ruby negative indices fizz buzz

# Rosettacode.org has this excellent one-line FizzBuzz solution in Ruby.
# It works because Ruby allows negative indices.

1.upto(100){|n|puts'FizzBuzz '[i=n**4%-15,i+13]||n}
Comment

PREVIOUS NEXT
Code Example
Ruby :: how to open ruby console 
Ruby :: ruby URI.open with proxy 
Ruby :: how to add two variables into a hash ruby 
Ruby :: rails check log level of application 
Ruby :: rails image_tag link size 
Ruby :: after_create for STI rails 
Ruby :: parameterized scope rails code 
Ruby :: array sort_by nil ruby 
Ruby :: rails do something for 3 minutes 
Ruby :: height of a tree in ruby 
Ruby :: send email rails c one line 
Ruby :: rails ngrok blocked host 
R :: convert list to dataframe r 
R :: r type of all columns 
R :: how to append in a list in R 
R :: r optim 
R :: view table/dataframe in r 
R :: rename columns based on a variable in r 
R :: how to do logistic regression in r 
R :: ggplot2 font times new roman 
R :: how to convert numeric to date in r 
R :: naming matrix in r 
R :: covert -Inf to 0 r 
R :: predict in r stack 
R :: bar plot r 
R :: rstudio 
R :: r most likely outcome 
R :: L in r 
R :: XLConnect 
R :: r count rows dataframe 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =