From: Phlip Date: 2010-09-07T09:15:07+09:00 Subject: Re: Dice Roller On Sep 6, 5:01 pm, Hd Pwnz0r wrote: > It won't work. It's odd. It won't stop and it won't add a number onto x > so it would say > "Roll 1: 5 > Roll 2: 3" > etc > > It just repeats "Roll 1: (random number)". > > Also, is there a way for me to add one to the rand function so it won't > get a zero? > > Attachments:http://www.ruby-forum.com/attachment/5009/dice.rb Next time just put it here: puts "How many dice do you want to roll?" roll = gets.chomp num_rolls = roll y = 0 x = y.to_i + 1 while x <= roll.to_i puts "Roll " + x.to_s + ": " + rand(max=6).to_s end Take out the gets.chomp: roll = '12' # gets.chomp that lets you work on the loop without entering over and over again. then either fix your while loop by incrementing: x += 1 or use an each loop (which is truly the Ruby way): (0...roll.to_i).each do |x| puts 'etc' end