irb(main):002:0> $$
=> 5052
What is the meaning of $$
in Ruby and How/Where to use it?
$$
is the process ID. It's named that way to follow Perl, which in turn followed the Bourne shell; both of them also use $$
in the same way.
This seems like a good reference for stuff like this...has a lot of symboly goodness.
It's the process ID of the Ruby interpreter. $ is a prefix for global variables, see here for a list.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With