Home > Blockchain >  What is $, (dollar comma)?
What is $, (dollar comma)?

Time:01-17

I see it's used in safe_join https://apidock.com/rails/v5.2.3/ActionView/Helpers/OutputSafetyHelper/safe_join

in irb it returns nil

irb(main):001:0> $,
=> nil

CodePudding user response:

$, is the separarator output between the arguments to print and the default separarator for Array.join. It is nil by default. Globals

CodePudding user response:

Thankfully, the magic global variables are now properly documented. According to this documentation, $, is

The output field separator for Kernel#print and Array#join.

That means the value of $, is the value that is used by Kernel#print and by Array#join as the default value for joining multiple elements. The default value of $, at startup is nil, which means that there is no separator between elements.

  •  Tags:  
  • Related