Question

Probably a really basic question, but I'll ask anyways. I tried googling my question but am having trouble getting results because I do not know the keywords to search. Any links for more info would be appreciated.

So, what happens to the value of a statement after execution? Maybe it's just because I'm in IRB that I am confusing myself. Example, if I am in IRB (Interactive Ruby) and execute the following: "Hello World"

Does the value disappear, forever lost? Or is it stored temporarily somewhere where it could be accessed? Thanks in advance!

Was it helpful?

Solution

The value is stored to a temporary variable _ which always stores the last command run in IRB.

In actual script execution, the value would float away into the netherlands. If you wanted to save it, you should assign it to a variable.

hello_world = "Hello World!"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top