From: Axel Etzold Date: 2008-05-30T21:33:44+09:00 Subject: Re: Proc multiple returns? -------- Original-Nachricht -------- > Datum: Fri, 30 May 2008 21:22:33 +0900 > Von: Ryan Lewis > An: ruby-talk@ruby-lang.org > Betreff: Re: Proc multiple returns? > Andreas Warberg wrote: > >... Dear Ryan, > > You dont understand, I'm making a simple HTML module for easy document > creating. > The code will look like this: > HTML::body { > "blahblah" > HTML::h1 { > "zomg headers" > } > } > > Assuming HTML::h1 returns "

zomg headers

", HTML::body will only > return "

zomg headers

". > But I need it to return ["blahblah", "

zomg headers

"] The function will always return the last statement - you could return an Array like this: HTML::body { [ "blahblah", HTML::h1 { "zomg headers" }] } -or use 'return' you want to return several arguments, like def func; return 1,2,3; end a,b,c=func => a=1,b=2,c=3 Best regards, Axel -- Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten Browser-Versionen downloaden: http://www.gmx.net/de/go/browser