From: Chad Perrin Date: 2011-07-28T06:29:05+09:00 Subject: Re: How do we read this line of code? --u3/rZRmxL6MmkK24 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jul 28, 2011 at 05:19:58AM +0900, Ryan Davis wrote: >=20 > On Jul 27, 2011, at 11:53 , Chad Perrin wrote: >=20 > > On Thu, Jul 28, 2011 at 03:24:08AM +0900, SW Engineer wrote: > >> If we have the following line of Ruby code: > >>=20 > >> @x.each do |x| > >>=20 > >> - What does |x| represent here? > >=20 > > It's an argument supplied to the block that follows. In this case, the > > argument is an element of @x passed to the block. > >=20 > >=20 > >> - How do we read the line (i.e; in English)? > >=20 > > I'd probably read it as something like: > >=20 > > For EACH element X of INSTANCE VARIABLE X, DO . . . >=20 > It is not an instance variable. Since when is @x not an instance variable? --=20 Chad Perrin [ original content licensed OWL: http://owl.apotheon.org ] --u3/rZRmxL6MmkK24 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAk4wfyEACgkQ9mn/Pj01uKXatACg9/iWD/uQqNMgAt4tfAGee9hP dz0AnAqHLqzhKMasTFBid8fV3RCO52GE =lbHr -----END PGP SIGNATURE----- --u3/rZRmxL6MmkK24--