hi i'm new to ruby so i'm going to be blowing up these forums with questions, this is just a real simple question. When you use the console and the editor itself, how do they correlate with one another? What is the purpose of each of them? i don't quite understand since i am new to using the console. Please explain!

When you use the editor you are writing code to a file. This file is then interpreted and run when you either type "irb myfile.rb" (for ruby) or "rails server" (for rails)

When you use the console you are typing code directly in to be run and interpreted as soon as you hit "enter".

There are two kinds of consoles. "irb" is the ruby console. You can type ruby commands in here.

"rails console" is the rails equivalent. You can type ruby in here also, but rails console also loads rails and all of the gems associated with rails as well as the gems in your Gemfile. so you can type rails commands in here as well and play with rails objects like the activemodel, etc.

Usually the text editor is for writing code that you want to be able to run over and over again. A computer program is usually something you want to be able to re-use. So you would write it in a text editor to be run and interpreted again later.

Usually the console is used to test things. I find the console very useful for this. You can open it up and just test to see how a certain command works. For instance if you wanted to play around with how the map method works for arrays. You can open up a console and create an array object, and send it the map message with different arguments to see what it does. The great thing about the console is instant feedback. You can see what you did and what happened because of what you did.

As soon as you leave the console (by typing "exit"), any code you typed in the console is lost and cannot be re-run without typing it all over again.

What is the purpose of each of them? i don't quite understand since i am new to using the console

I had the same question when I first started ruby.

You remember VCR's (Video Cassette Recorders)? Well VCR's use Video Cassettes and in side the those cassettes are long ribbons of film that hold the frames.

Think of it like this, you could totally write an entire program (cassette) in the irb console, line by line (frame by frame) - But instead you can just create files (cassettes) in your IDE and hit play on the console (VCR). You can even go to the store pick up open source cassettes (ruby gems) for free, just to play around with in your program (VCR).

FYI, Calling play in the console can be done by typing "ruby play_cassette.rb"