From: Jeremy Bopp Date: 2012-02-04T10:03:42+09:00 Subject: Re: 4 random numbers take highest 3 and add them together. h4y4shi 13bladex wrote: >I want to get 4 random numbers. The numbers will be between 1-6. I want >to disregard the smallest number and add the three biggest numbers >together. So far I wrote some ruby that I thought would do this but I >keep getting an error. > >statsrand = 0 >while statsrand == 0 >stats1a = (rand(6) + 1) >stats1b = (rand(6) + 1) >stats1c = (rand(6) + 1) >stats1d = (rand(6) + 1) >gstats1a = 0 >gstats1b = 0 >gstats1c = 0 >gstats1d = 0 >when (stats1a>stats1b) | (stats1a>stats1c) | (stats1a>stats1d) > gstats1a = stats1a >when (stats1b>stats1a) | (stats1b>stats1c) | (stats1b>stats1d) > gstats1b = stats1b >when (stats1c>stats1b) | (stats1c>stats1a) | (stats1c>stats1d) > gstats1c = stats1c >when (stats1d>stats1b) | (stats1d>stats1c) | (stats1d>stats1a) > gstats1d = stats1d > >mstr = gstats1a + gstats1b + gstats1c + gstats1d > >I cant find where the error is... It would be easier for others to help you if you included the actual error message you get in addition to the code that purportedly produced the error. Not everyone seeing your post has the ability (that's me at the moment) or desire to copy and paste your code, but they may be able to help anyway with the error message in hand. :-) -Jeremy