-------- Original-Nachricht --------
> Datum: Fri, 30 May 2008 21:22:33 +0900
> Von: Ryan Lewis <c00lryguy / gmail.com>
> 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 "<h1>zomg headers</h1>", HTML::body will only 
> return "<h1>zomg headers</h1>".
> But I need it to return ["blahblah", "<h1>zomg headers</h1>"]

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