I'm sending a POST request in an API that returns a token, how do I assign a variable to this generated value?
Asked
Active
Viewed 52 times
-2
-
`[@|@@|$]variable_name = value`. – max Oct 03 '22 at 18:35
1 Answers
0
In Ruby, you assign a variable using the equal sign =
binary infix assignment operator. See section 11.4.2.2.2 Single variable assignments of the ISO/IEC 30170:2012 Information technology — Programming languages — Ruby specification.
For example, to assign the result of sending the message bar
to the local variable foo
, you would write:
foo = bar

Jörg W Mittag
- 363,080
- 75
- 446
- 653