Forum: Ruby gets.chomp....... not function

2a3868e4f3fd80939e7105832e25337c?d=identicon&s=25 Vister Gade (gade)
on 2008-04-14 05:13
heloo.... i m a beginner of ruby...

so i have a problem about gets function or gets.chomp.....

when i run at SciTE.... it will not do anything... just a command
blank....
if i run it from file to ruby interpreter... the question will appear...
but when i insert input and enter... it will disappear....


what are the problem is had... and what are the solution.....

please help.....

thanks...
F42ca7213b32b4382fb79e05f5ab7619?d=identicon&s=25 Daniel Finnie (Guest)
on 2008-04-14 05:28
(Received via mailing list)
Hi,

Can you post your code?

Generally, programs requiring user interaction do not work well in
programs like SCiTE and should be run from the command line.

Here is an example of using gets:
puts "What is your favorite color?"
color = gets
if gets == "red"
  puts "that's mine too!"
else
  puts "bad choice..."
end

Dan
2a3868e4f3fd80939e7105832e25337c?d=identicon&s=25 Vister Gade (gade)
on 2008-04-14 06:04
puts ' What is your full name?'
name = gets.chomp
puts ' Did you know there are ' + name.length.to_s + ' characters'
puts ' in your name, ' + name + ' ?'
88ef015456c23e0081739db50d3d6b53?d=identicon&s=25 Kyle Hunter (phenax)
on 2008-04-14 06:26
Vister Gade wrote:
> heloo.... i m a beginner of ruby...
>
> so i have a problem about gets function or gets.chomp.....
>
> when i run at SciTE.... it will not do anything... just a command
> blank....
> if i run it from file to ruby interpreter... the question will appear...
> but when i insert input and enter... it will disappear....
>
>
> what are the problem is had... and what are the solution.....
>
> please help.....
>
> thanks...

The Windows command prompt closes after the program is done running
unless the program was run by an already existing command prompt IIRC.
My advice would be to opening a command prompt, and running it from an
already opened command prompt. This should allow you to see the output
of your program.
2a3868e4f3fd80939e7105832e25337c?d=identicon&s=25 Vister Gade (gade)
on 2008-04-14 07:15
Kyle Hunter wrote:
> Vister Gade wrote:
>> heloo.... i m a beginner of ruby...
>>
>> so i have a problem about gets function or gets.chomp.....
>>
>> when i run at SciTE.... it will not do anything... just a command
>> blank....
>> if i run it from file to ruby interpreter... the question will appear...
>> but when i insert input and enter... it will disappear....
>>
>>
>> what are the problem is had... and what are the solution.....
>>
>> please help.....
>>
>> thanks...
>
> The Windows command prompt closes after the program is done running
> unless the program was run by an already existing command prompt IIRC.
> My advice would be to opening a command prompt, and running it from an
> already opened command prompt. This should allow you to see the output
> of your program.



Thanks... can u teach me how to run in step by step.... sorry but i
really needing u help....
Ac0085dae0703db56ad7f8cb9e1798ba?d=identicon&s=25 Phillip Gawlowski (Guest)
on 2008-04-14 07:22
(Received via mailing list)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Vister Gade wrote:

|> The Windows command prompt closes after the program is done running
|> unless the program was run by an already existing command prompt IIRC.
|> My advice would be to opening a command prompt, and running it from an
|> already opened command prompt. This should allow you to see the output
|> of your program.
|
|
|
| Thanks... can u teach me how to run in step by step.... sorry but i
| really needing u help....

Start -> Run... -> cmd<enter> -> help<enter>

Navigate to the directory you saved the Ruby script, and type "ruby
name_of_your_script.rb".

This assumes that Ruby is in your path. Otherwise, you'll have to type
in the path to ruby.exe, too (For example: "c:\ruby\bin\ruby.exe
your_scrupt.rb").

More help can be found here: http://www.google.com /


- --
Phillip Gawlowski
Twitter: twitter.com/cynicalryan

~ - You know you've been hacking too long when...
...you've been low-level debugging ethernets for a week and you see two
people at a table trying to pick up the same jar of butter and you
directly wonder if they are using the correct CSMA/CD algorithm to avoid
a re-collision.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkgC6fsACgkQbtAgaoJTgL8K2wCgp8bne4hva7aPHeF88QCSmtXS
HsQAn1AaZVHSKHb1oKwYaJ+r8BaWagXx
=Uu7T
-----END PGP SIGNATURE-----
4828d528e2e46f7c8160c336eb332836?d=identicon&s=25 Robert Heiler (shevegen)
on 2008-04-14 13:25
> Thanks... can u teach me how to run in step by step.... sorry but i
> really needing u help....

For testing purposes you should use irb (irb.bat or whatever the name on
windows was), this way you are independent of a GUI (and bugs or
problems inside that GUI) too.
3ff88ae00cf720fd8f05d246f51dc93a?d=identicon&s=25 svu b. (svu_b)
on 2011-06-17 09:41
in ruby how to create classes and how to run through editors. if
avilable please guide editor name . how can we debug script .its
difficult to find  errors .if possible send me word doc step by steps.
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.