Timeline for answer to How to return value from a Ruby function for use in the rest of the program by daremkd
Current License: CC BY-SA 3.0
Post Revisions
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| May 23, 2017 at 11:57 | history | edited | URL Rewriter Bot |
replaced http://stackoverflow.com/ with https://stackoverflow.com/
|
|
| Oct 9, 2014 at 15:07 | vote | accept | Community Bot | ||
| Oct 9, 2014 at 15:06 | comment | added | user511345 | @Phil Oh, I see. I'm used to doing this in PHP, where I would 'return' a value for use and have it be assigned already. | |
| Oct 8, 2014 at 10:23 | comment | added | Phil | @Elisa - that will work if you follow rohit89's example below. You'll have to reassign it to mrn. | |
| Oct 8, 2014 at 8:16 | comment | added | Jörg W Mittag | Ruby is pass-by-value, not pass-by-reference. You cannot pass variables, variables aren't objects. You can only pass objects. | |
| Oct 8, 2014 at 2:29 | comment | added | user511345 | Thanks for the explanation & the example. I thought that the "return" command would cause the altered variable to be available outside of the function, am I mistaken? | |
| Oct 7, 2014 at 22:00 | history | answered | daremkd | CC BY-SA 3.0 |