From: Paul Danese Date: 2007-02-21T03:33:16+09:00 Subject: adding local variables via block ------_=_NextPart_001_01C7551D.56D949D1 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi, =20 i'm a roob noob and I'm trying to grasp procs/blocks/etc. =20 =20 specifically, I'd like to pass a piece of code into a method. the piece of code will contain a variable name and an assignment =20 e.g. =20 #################### def lamb_test =20 cond =3D 'hello' yield puts cond + ' ' + name end lamb_test {name =3D 'bob'} ################### =20 When I do this, I get the following error: "undefined local variable or method `name' for main:Object... =20 is it possible to define a local variable like this on the fly with blocks? obviously, this is an oversimplified case but I want to be able to dynamically insert a local variable and an assignment to that variable into the "generic" function lamb_test Is there a better way? =20 TIA! ------_=_NextPart_001_01C7551D.56D949D1--