From: andrea Date: 2012-04-04T16:39:46+09:00 Subject: Re: fibonacci and defining variables --_=__=_XaM3_.1333525178.2A.313957.42.25312.52.42.007.1684519075 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable A little more readable (but I'd still prefer using a temp variable):=0A=0A= p, i =3D p + i, p=0A=0ABest,=0A=0AAndrea=0A=C2=A0=0A--=0A=C2=A0=0Ahttp://= usingimho.wordpress.com=0Ahttp://github.com/bolthar=0ADa: "Michal M." lis= ts@ruby-forum.com=0AA: ruby-talk@ruby-lang.org=0ACc: =0AData: Wed, 4 Apr = 2012 16:34:40 +0900=0AOggetto: Re: fibonacci and defining variables=0A=0A= > Bartosz Dziewo=C5=84ski wrote in post #1054873:=0A> > W dniu 3 kwietnia= 2012 21:24 u=C5=BCytkownik Christopher D.=0A> > napisa=C5=82:=0A> >> Co= ol, that makes sense, is there any way to do it sequentially without=0A> = >> it being on the same line?=0A> > tmp =3D p=0A> > p =3D i+p=0A> > = i =3D tmp=0A> >=0A> =0A> You may omit the temporary variable, although w= ith less readable code:=0A> =0A> p =3D p + i=0A> i =3D p - i=0A> =0A> -- = =0A> Posted via http://www.ruby-forum.com/. --_=__=_XaM3_.1333525178.2A.313957.42.25312.52.42.007.1684519075 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable =0A
=0A
A little more readable (but I'd still pr= efer using a temp variable):

p, i =3D p + i, p

Best,

Andrea
&= nbsp;
--
 
http://usingimho.wordpress.= com
http://github.com/bolthar


=0A
Da: "= Michal M." lists@ruby-forum.com
=0A
A: ruby-ta= lk@ruby-lang.org
=0A
Cc:
=0A
= Data: Wed, 4 Apr 2012 16:34:40 +0900
=0A
Oggetto: Re: fibonacci and defining variables
=0A
=0A=
> Bartosz Dziewo=C5=84ski wrote in post #1054873:
> = > W dniu 3 kwietnia 2012 21:24 u=C5=BCytkownik Christopher D.
> > napisa=C5=82:
> >> Cool, that makes sense, is there any way to do it = sequentially without
> >> it being on the same line?
> > tmp =3D p
> > p =3D i+p
= > > i =3D tmp
> >
>
> = You may omit the temporary variable, although with less readable code:
>
> p =3D p + i
> i =3D p - i
=
>
> --
> Posted via http://www.ruby-f= orum.com/.
=0A
=0A --_=__=_XaM3_.1333525178.2A.313957.42.25312.52.42.007.1684519075--