Computer Science Canada

help for a n00b!

Author:  Thuged_Out_G [ Wed Nov 02, 2005 3:27 am ]
Post subject:  help for a n00b!

just downloaded ruby. got this 'scite' compiler .... erm, how do i run the programs .... i understand a ruby file is a '.rb' file .... but how do you run the program?

Author:  [Gandalf] [ Wed Nov 02, 2005 4:30 am ]
Post subject: 

SciTe is not a compiler, it is an editor, learn the difference. Ruby does not have a compiler, it is interpreted through (guess what) and interpreter.

To run the program (if it is already not set up for automatic interpreting on double-click) you need to use the command line. In the folder where the source file is, type something like "ruby sourceFile.rb", I don't remember the specifics.

For more help, look here:
http://www.compsci.ca/v2/viewforum.php?f=59
or check IRC (irc.afternet.org #compsci.ca) where someone may help you:
http://www.afternet.org/component/option,com_chat/Itemid,60/

Author:  Tony [ Wed Nov 02, 2005 11:40 am ]
Post subject: 

go to your command line (start -> run -> cmd)

from there
code:

ruby source_file.rb

or better yet
code:

irb

for some interactive shell action Wink
code:

N:\>irb
irb(main):001:0> puts "Hello Ruby!"
Hello Ruby!
=> nil
irb(main):002:0> exit

N:\>

Author:  Cervantes [ Wed Nov 02, 2005 3:59 pm ]
Post subject: 

[Gandalf] wrote:
SciTe is not a compiler, it is an editor, learn the difference.

Right, but Scite can execute the code and display it in the output pane. Very Happy

Search around the menus (File, Edit..). You might find it under Tools.

edit: But, don't let it steer you away from using irb. irb will be your best friend.

Author:  Thuged_Out_G [ Wed Nov 02, 2005 10:09 pm ]
Post subject: 

this 'irb' ... could i type a whole program in there, and then execute it? or does it just go line by line type deal?

im new to all this, only other language i learned was turing. all this talk about ruby, figure i may aswell jump in lol

Author:  wtd [ Wed Nov 02, 2005 10:25 pm ]
Post subject: 

Thuged_Out_G wrote:
this 'irb' ... could i type a whole program in there, and then execute it? or does it just go line by line type deal?


A little of both. Smile

It will accept one piece of code that makes sense at a time. This might be a single line of code, but it might be more than one line.

code:
irb(main):001:0> 1 + 2
=> 3
irb(main):002:0> 1 +
irb(main):003:0*
irb(main):004:0* 2
=> 3
irb(main):005:0>


The other thing to keep in mind is that it remembers what has happened on previous lines.

code:
irb(main):005:0> foo = 42
=> 42
irb(main):006:0> puts foo
42
=> nil
irb(main):007:0>

Author:  Clayton [ Sat Jun 17, 2006 10:01 pm ]
Post subject: 

how do you execute in SciTE though? i'm starting to learn Ruby (tired of Turing and its limitations) because ive heard many a good things about it, but i am unsure of how to run it Sad (yes i have read the above posts, but could someone explain it in a bit more of step-by-step thing plz Very Happy )

Author:  rdrake [ Sat Jun 17, 2006 10:41 pm ]
Post subject: 

SuperFreak82 wrote:
how do you execute in SciTE though? i'm starting to learn Ruby (tired of Turing and its limitations) because ive heard many a good things about it, but i am unsure of how to run it Sad (yes i have read the above posts, but could someone explain it in a bit more of step-by-step thing plz Very Happy )
As I recall, you press F5.


: