New to Ruby is $ depricated?

Hello ALL … I am just starting out and every turn so far has not been easy. I am figuring it out as I go but it is frustrating. I am seeing it used, the $ at the beginning of the line of code.

Every time I enter it with an example, $ ruby puts “Hello World!” for example it throws an error. That ‘$’ is not recognized…internal / external command, op program or batch file. I have 2.3.3p222 and 2.4.5 with MSYS2 installed and would I be wrong to guest. This went out or was only relevant in 1.9 versions??

I am working off the command-line and have no trouble using mkdir or navigating and opening the ruby files I am making. I am using Programming Ruby 1.9/2.0 by Dave Thomas 2013 edition paper copy. Plus the free tutorial from Pragmatic`s site.

Most important is I finally found this site that I hope is active, Stack Overflow is out of the question for me. I know I have no experience and this is all very new to me. Asking for help on that site is a kick in the nuts and you are left feeling like you are wasting their precious time. Just looking for a solid place to ask questions and in return as time goes on, give back or direct to a valid source. Thanks as this is a introduction to a new newbie. But wondering about the $ sign.

I just keep chipping away at it thanks in advance and …Peace…

$ is what their command line prompt looks like, ignore it.

Thanks for the reply and I got the code to run by omitting it. Being new it shows it used then you get an error. Make it very frustrating…
I did read a few hours ago the the $ dollar sign is the prefix for Global variables. Example: $debug $Customer $_ $Global

It further mentioned: "Although we talk about global and class variables here for completeness, you’ll find they are rarely used in Ruby programs. As evidence shows global var’s make programs harder to maintain.
At least now I know what they are and it makes sense now if I compare what global`s do in JavaScript. They make your script unpredictable if you use the same name as a local variable.

Getting the hang of it and just need to keep at it … what is up with using ri ?? When ever I applied it to a method to see its doc`s. All I get back is nothing known. I said the hell with it and moved on…

Thanks for your time and help…Peace…

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs