From: Jeremy Tregunna Date: 2006-05-25T03:19:38+09:00 Subject: Re: ifs and scope --Apple-Mail-18-536354689 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed On 24-May-06, at 2:13 PM, newbie wrote: > i am sorry if this is really newb, but i am new to programming and =20 > ruby > in general > > in my previous thread "disappearing hash values" it was pointed out to > me that a new if is a new scope > > how do i update a second if with the results from a first > > ie > > if (something) > #do a bunch of stuff > firstif =3D TRUE > end > > if (somethingelse && firstif) > # the above always fails since the second if doesn't see firstif) > #do other stuff that is dependent on the first bunch of stuff > firstif =3D FALSE > end Set your firstIf variable to a sentinel before running either if. =20 I.e., set it to false, then only if your first if statement passes, =20 will the second one be run. -- Jeremy Tregunna jtregunna@blurgle.ca "The proof is the proof that the proof has been proven and that's the =20= proof!" - Jean Chr=E9tien --Apple-Mail-18-536354689--