> On Mon, Feb 14, 2011 at 11:35 PM, hard wyrd <[email protected]> wrote: >> >> Can your language do this? >> > eeny,meeny,miney,mo=1+1,1*2,1^10,1/1 >> > print(eeny,meeny,miney,mo) >> 2 2 1 1 >> > eeny,meeny,miney,mo=mo,meeny,miney,eeny >> > print(eeny,meeny,miney,mo) >> 1 2 1 2
On Tue, Feb 15, 2011 at 8:47 PM, Paul Michael Labis <[email protected]> wrote: > Multiple variable assignment eh! Try it on groovy... > I know you can at least do it like... Not sure though I wasn't able to really > dig deep on groovy language but theres a good documentation that'll help... > > def (eeny,meeny,miney,mo) = [1+1,1*2,1^10,1/1] > println(eeny,meeny,miney,mo) > > def (eeny,meeny,miney,mo) = [mo,meeny,miney,eeny] > println(eeny,meeny,miney,mo) Hmm... Interesting subject (and we've haven't anything interesting in this list for a while, LOL). It's a cool feature, but any developer who uses this feature on a real-world project will probably get an earful from me for sacrificing maintainability/readability for the sake of coolness. I can only imagine how many keystrokes you'd waste trying to edit a variable that's in the middle of an enumerated list - not too mention the bugs you might introduce because you missed which variable is on which value (Nalibat ug tan-aw bah, LOL) On a similar note, I do lurv using the ternary operator in PHP [1] - but that's because I'm too lazy to write a whole if-else block when I can do it with one line. It also makes me look cool sa mga newbies. Haha! [1] http://en.wikipedia.org/wiki/Ternary_operator#Perl.2C_PHP -- Matt Arnilo S. Baluyos http://www.onxiam.com/people/mbaluyos/ v3sw3CH+Rhw2ln5pr6OPck5ma7u5Lw5Xm+7l7CRi2e6t5Xb7Oen4g5aIs4r3p6 hackerkey.com gpg --keyserver pgp.mit.edu --recv-keys 171CD03E _________________________________________________ Kagay-Anon Linux Users' Group (KLUG) Mailing List [email protected] (http://lists.linux.org.ph/mailman/listinfo/klug) Searchable Archives: http://archives.free.net.ph
