"ruby filename.rb" is not opening my file
I'm new to Ruby, new to scripting languages, but not entirely new to programming. I have about a year's experience with Java, but this whole command line thing is just messing with my head.
I'm following this tutorial, just for the heck of it:
http://www.ruby-lang.org/en/documentation/quickstart/3/
and it's all simple and fine until I'm asked to save a file and run it from the IRB. I enter "ruby ri20min.rb" (without quotations, of course) into the IRB. I get this error:
NameError: undefined local variable or method 'ri20min' for main:Object from (irb):1
What am I doing wrong? The tutorial seems to imply that the file is supposed to be run through IRB; but maybe it's supposed to got through Command Prompt? Well,开发者_JAVA百科 I tried that too but it tells me:
'ruby' is not recognized as an internal or external command, operable program, or batch file.
Thanks in advance for any help you can give! This twenty minute tutorial has frustrated me for over an hour of syntax adjustments and googling.
First, don't run ruby ri20min.irb
from within IRB, you're supposed to run it from the command line, as you suspected. The error you get there is most likely related to the fact that the Ruby executable is not in your PATH environment variable.
精彩评论