Really interesting Ruby question on SO

This is a really interesting question from StackOverflow. What would you expect to be the result from the following code:

   1:  (test1, test2, test3="3", test4="4")

Or maybe:

   1:  (test1, test2, test3="3", test4="4", test5 = "5", test6 = "6")

For the first one, test1 = “3”, test2 = “4”, and test3 = nil (aka null in C# world). The explanation is in an answer, but basically its because or Ruby allowing multiple assignments and Right Hand result assignment.  I’d upvote the answer but I don’t have enough SO rep. :(

 
June 17, 2010 14:39 by josh
E-mail | Permalink
blog comments powered by Disqus


about josh

another programmer blogging about his misadventures in writing code.

Contact

contact us for website & software consulting

Decide

decide on pragmatic solutions

Develop

develop your product together

Succeed

achieve your goals with our services