From: smc smc Date: 2007-04-18T07:28:38+09:00 Subject: Re: new oh now i got this... h-68-164-42-185:~ stefan$ ruby ruby.rb ruby: No such file or directory -- ruby.rb (LoadError) h-68-164-42-185:~ stefan$ cd documents h-68-164-42-185:~/documents stefan$ ruby hello.rb hello.rb:1: Invalid char `\320' in expression hello.rb:1: Invalid char `\317' in expression hello.rb:1: Invalid char `\021' in expression hello.rb:1: Invalid char `\340' in expression hello.rb:1: Invalid char `\241' in expression hello.rb:1: Invalid char `\261' in expression h-68-164-42-185:~/documents stefan$ do i need to get into irb then out and then do it? On 4/17/07, smc smc wrote: > oh ok > i think i know where i made my mistake > thanks > On 4/17/07, Morton Goldberg wrote: > > On Apr 17, 2007, at 2:59 PM, Morton Goldberg wrote: > > > > > On Apr 17, 2007, at 1:22 PM, poison tooth wrote: > > > > > >> Im just learning ruby and im stuck the guide im using says > > >> > > >> "Your first program > > >> Congratulations! Now that you have made it this far, you are ready to > > >> start writing programs. > > >> Hello World > > >> Grab a text editor and type in the following: > > >> > > >> puts "Hello World" > > >> > > >> Save the file as hello.rb and run it by typing > > >> ruby hello.rb" > > >> > > >> i've tried that more than once and it says the out is: > > >> > > >> "irb(main):001:0> ruby hello.rb > > >> NameError: undefined local variable or method `hello' for main:Object > > >> from (irb):1 > > >> irb(main):002:0> " > > >> > > >> the guide never said what word processor should i use > > >> i tried TextEdit.app but it fussed about the .rb > > >> so i used Microsoft word and this is what it does... > > >> > > >> Any tips? > > > > > > Since you mention TextEdit, I presume you are on a Mac. Also, since > > > you mention irb, I presume you are familiar with Terminal. Here is > > > an easy way to run a Ruby script in Terminal. After writing your > > > hello script in TextEdit save it as hello.rb. Now in terminal at a > > > fresh prompt, type "ruby " (without the quotes and remember to > > > include the space after "ruby"). Now drag hello.rb into to Terminal > > > and hit return. The text "Hello World" should appear. > > > > Also, there is one more possible source of trouble. TextEdit must be > > in Plain Text mode when you save a Ruby script. If it's in Rich Text > > mode, hit cmnd-shift-T to change the mode before you save. > > > > Regards, Morton > > > > > > > -- > fish can't fly but birds can > birds can't swim but fish can > > -- fish can't fly but birds can birds can't swim but fish can