Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Fibonacci numbers with lvalues

by ariels (Curate)
on Nov 30, 2000 at 13:14 UTC ( #44096=snippet: print w/replies, xml ) Need Help??
Description: This snippet shows how to use an expression as an lvalue. It's based on something my boss said you could only do in Algol68.
($a,$b) = (0,1);
($a < $b ? $a : $b) = $a+$b
  for (1..$n);
print $n%2 ? $a : $b, "\n"
Replies are listed 'Best First'.
Re: Fibonacci numbers with lvalues
by Adam (Vicar) on Dec 01, 2000 at 07:11 UTC
    Heh, that's pretty cool.

    (For a moment there I was gonna point out that you missed the whole Fibonacci thread, but your post isn't really about the series, its about assigning to an expression.)

    ARGH! Thanks to the power of Preview I was checking that link and discovered that half the Fibonacci thread is missing (the TOP half!) I'll have to msg Vroom about that. Part of the bottom half of that thread is RE: RE (tilly) 1: Fibonnaci. Notice the links to the top half don't exist. Very weird.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: snippet [id://44096]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2023-03-24 18:02 GMT
Find Nodes?
    Voting Booth?
    Which type of climate do you prefer to live in?

    Results (61 votes). Check out past polls.