Right (although you'll want a "do" after that "else"). In addition,

= [1, 2, 3].map do |i|
  - i + 1
- end.join("<br/>")

will also work.

On Sun, Mar 15, 2009 at 11:40 PM, Jacques Crocker <[email protected]> wrote:
>
> Wow... thats a pretty awesome feature. So the following block of code
> will work in Haml 2.1?
>
> - results.each do |x|
>  %li
>    hit:
>    = x
>
> - end.else
>  %li no hits found
>
>
> On Mar 15, 7:08 pm, Nathan Weizenbaum <[email protected]> wrote:
>> This is now allowed in master.
>>
>> On Sun, Mar 15, 2009 at 3:08 AM, weepy <[email protected]> wrote:
>>
>> > :pauls.methods' has an useful idea on extending enumerable to support
>> > an else if it's empty :
>>
>> >http://blog.sponagl.de/2009/1/23/alternative-block-execution-on-empty...
>>
>> > Essentially in ERB it allows :
>>
>> > <% results.each do |x| %>
>> >  <li>hit:<%=x-%></li>
>> > <% end.else do %>
>> >  <li>no hits found</li>
>> > <% end %>
>>
>> > Is there any way to call this in HAML ?
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Haml" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to