Posted: Thu Nov 04, 2004 10:56 pm Post subject: wtd, ruby questions
hi wtd,
here is my post on Ruby questions..
Save your program (yes, that's a program!) as calc.rb (the .rb is what we usually put at the end of programs written in Ruby). Now run your program by typing ruby calc.rb into your command line. It should have put a 3 on your screen. See, programming isn't so hard, now is it?
ok i saved it as calc.rb but where and how do i or where do i type in ruby calc.rb ??
Sponsor Sponsor
Hikaru79
Posted: Thu Nov 04, 2004 11:01 pm Post subject: (No subject)
I think he was assuming you were working in a UNIX environment, where 'ruby calc.rb' would look in the PATH for 'ruby' and then run it with the argument 'calc.rb'.
Not sure how that would work in Windows. Does Windows even have a global path? Try going "Start->Run" and putting "ruby calc.rb" there... ionno. Check the documentation of wherever you installed the ruby interpreter/compiler.
dsantamassino
Posted: Thu Nov 04, 2004 11:03 pm Post subject: (No subject)
Hikaru79 wrote:
I think he was assuming you were working in a UNIX environment, where 'ruby calc.rb' would look in the PATH for 'ruby' and then run it with the argument 'calc.rb'.
Not sure how that would work in Windows. Does Windows even have a global path? Try going "Start->Run" and putting "ruby calc.rb" there... ionno. Check the documentation of wherever you installed the ruby interpreter/compiler.
I did typed that in run just now and it flashed a black windows but nothing happened.
wtd
Posted: Thu Nov 04, 2004 11:04 pm Post subject: (No subject)
Which version of Windows are you using?
For Win 98, ME:
Go to Start -> Run, and type "command". This will give you a command prompt. You'll need to "cd" (change directory) to the directory where you saved calc.rb.
For Win 2000, XP:
Go to Start -> Run, and type "cmd". This will give you a command prompt. You'll need to "cd" (change directory) to the directory where you saved calc.rb.
wtd
Posted: Thu Nov 04, 2004 11:05 pm Post subject: (No subject)
dsantamassino wrote:
Hikaru79 wrote:
I think he was assuming you were working in a UNIX environment, where 'ruby calc.rb' would look in the PATH for 'ruby' and then run it with the argument 'calc.rb'.
Not sure how that would work in Windows. Does Windows even have a global path? Try going "Start->Run" and putting "ruby calc.rb" there... ionno. Check the documentation of wherever you installed the ruby interpreter/compiler.
I did typed that in run just now and it flashed a black windows but nothing happened.
It's doing something, but your program runs and then finishes and Windows thinks it's done so it closes the output window. If you had a machine 100x slower, you might see something.
dsantamassino
Posted: Thu Nov 04, 2004 11:08 pm Post subject: (No subject)
wtd wrote:
Which version of Windows are you using?
For Win 98, ME:
Go to Start -> Run, and type "command". This will give you a command prompt. You'll need to "cd" (change directory) to the directory where you saved calc.rb.
For Win 2000, XP:
Go to Start -> Run, and type "cmd". This will give you a command prompt. You'll need to "cd" (change directory) to the directory where you saved calc.rb.
I dont have a clue about commands. I saved it to my E drive so i went cd E:\ but i know thats wrong. Im running Win XP Pro SP2.
wtd
Posted: Thu Nov 04, 2004 11:10 pm Post subject: (No subject)
dsantamassino wrote:
wtd wrote:
Which version of Windows are you using?
For Win 98, ME:
Go to Start -> Run, and type "command". This will give you a command prompt. You'll need to "cd" (change directory) to the directory where you saved calc.rb.
For Win 2000, XP:
Go to Start -> Run, and type "cmd". This will give you a command prompt. You'll need to "cd" (change directory) to the directory where you saved calc.rb.
I dont have a clue about commands. I saved it to my E drive so i went cd E:\ but i know thats wrong. Im running Win XP Pro SP2.
Should look something like that. Learning how to use the command-line is key to learning how to program.
dsantamassino
Posted: Thu Nov 04, 2004 11:15 pm Post subject: (No subject)
wtd wrote:
dsantamassino wrote:
wtd wrote:
Which version of Windows are you using?
For Win 98, ME:
Go to Start -> Run, and type "command". This will give you a command prompt. You'll need to "cd" (change directory) to the directory where you saved calc.rb.
For Win 2000, XP:
Go to Start -> Run, and type "cmd". This will give you a command prompt. You'll need to "cd" (change directory) to the directory where you saved calc.rb.
I dont have a clue about commands. I saved it to my E drive so i went cd E:\ but i know thats wrong. Im running Win XP Pro SP2.