It would help if you told us *how* the script broke.  E.g. what error
message did you get?

However, from what you've written it looks like you are not converting the
number that the user has input from a string to an integer.

For example:

irb(main):005:0> print "hello" * "4"
TypeError: no implicit conversion from string
        from (irb):5:in `*'
        from (irb):5
irb(main):001:0> print "hello" * 4
hellohellohellohellonil
irb(main):007:0> print "hello" * "4".to_i
hellohellohellohellonil

Cheers,
            Nat.

________________________________
Dr. Nathaniel Pryce
B13media Ltd.
Studio 3a, Aberdeen Business Centre, 22/24 Highbury Grove, London, N5 2EA
http://www.b13media.com

----- Original Message -----
From: "niall munnelly" <aleph / aleph-null.net>
To: "ruby-talk ML" <ruby-talk / ruby-lang.org>
Sent: Friday, June 07, 2002 10:29 PM
Subject: big dumb very newbie question


> hello -
>
> i'm not just new to ruby, i'm quite new to programming in general (beyond
> some massively kludgy shell scripts).
>
> i've been rtfming, but haven't found an answer yet, so i'd be most
> appreciative for any gentle nudges in the right direction.
>
> right now i'm working on a little script that will output x number of
> iterations of a user-defined statement.
>
>
>
> print "what comment should i use?\n"
>
> $enterComment = STDIN.gets
>
>         $enterComment.chop!
>
> print "how many iterations do you want?\n"
>
> $enterNumber = STDIN.gets
>
>         $enterNumber.chop!
>
> $total = $randomComment + $enterComment + $protect
>
> print $total * $enterNumber
>
>
> the script breaks on this last line, when i attempt to print $total
> $enterNumber times.  printing $total * 10 yields the expected results;
> printing $enterNumber alone yields the expected result, but i can't get
that
> "print $total * $enterNumber" line to work.
>
>
> help?
>
>
> thanks....
>
> --
> yours,
> niall.
> .. .  .   .    .     .       .           .             .                 .
> aleph null.                             a simple insinuation around
silence.
> see: http://www.vietnambla.com         hear: http://radio.vietnambla.com
>
> .. .bebox.audio. ..
> playing now:  neil harvey - vs dettinger - sub rosa vs kompakt