I have a doubt concerning #{$$} inside a double quoted string, in concrete I have this string:
"#{command}#{$$}#{(Time.now.to_f * 1000).to_i}"
If I execute "#{$$}" in console I get an integer number but I would like to read an explanation to this.
Thank you !!
$$
is the interpreter's process ID.
Ruby has quite a few global variables you can use, see here.
That would be the global process ID .
If you're asking what the #{...} syntax means, that prints the variable inside the braces. So if it would work like this..
command = "print"
puts "cmd: #{command}" #=> cmd: print
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.