An error I can't find

Hello, there's certainly a monstrous error I don't see in :
<% for i in @news %>
  <% if dern_cat != i.categorie %>
   <% case i.categorie %>
   <% end %>
  <% end %>
<% end %>

I've removed all the code I could and don't understand why the case i.categorie produce a syntax error, unexpected tIDENTIFIER, expecting kWHEN

What is that syntax error ?

Thank you

This is just what I found, maybe it'll help:
   
  http://www.ruby-doc.org/docs/UsersGuide/rg/control.html
   
  l- ooking at their example it seems the syntax should be:
  case
    when
  end
   
  I guess that's why it's saying it's expecting "when".

···

Zouplaz <user@domain.invalid> wrote:
  Hello, there's certainly a monstrous error I don't see in :

<% for i in @news %>
  <% if dern_cat != i.categorie %>
   <% case i.categorie %>
   <% end %>
  <% end %>
<% end %>

I've removed all the code I could and don't understand why the case
i.categorie produce a syntax error, unexpected tIDENTIFIER, expecting kWHEN

What is that syntax error ?

Thank you

---------------------------------
Be a better Globetrotter. Get better travel answers from someone who knows.
Yahoo! Answers - Check it out.

Zouplaz schrieb:

Hello, there's certainly a monstrous error I don't see in :
<% for i in @news %>
<% if dern_cat != i.categorie %>
  <% case i.categorie %>
  <% end %>
<% end %>
<% end %>

I've removed all the code I could and don't understand why the case i.categorie produce a syntax error, unexpected tIDENTIFIER, expecting kWHEN

What is that syntax error ?

Thank you

The correct Syntax would be something like this (not tested):
<% for i in @news %>
  <% if dern_cat != i.categorie %>
   <% case i.categorie %>
     <% when bar then foo %>
   <% end %>
  <% end %>
<% end %>

I removed the 'when' statements just to have the shortest source code...
with

when 'foo'
   doit()
when 'bar'
   dont()

the error is the same

···

le 19/06/2007 13:46, Daniel Kempkens nous a dit:

Zouplaz schrieb:

Hello, there's certainly a monstrous error I don't see in :
<% for i in @news %>
<% if dern_cat != i.categorie %>
  <% case i.categorie %>
  <% end %>
<% end %>
<% end %>

I've removed all the code I could and don't understand why the case i.categorie produce a syntax error, unexpected tIDENTIFIER, expecting kWHEN

What is that syntax error ?

Thank you

The correct Syntax would be something like this (not tested):
<% for i in @news %>
<% if dern_cat != i.categorie %>
  <% case i.categorie %>
    <% when bar then foo %>
  <% end %>
<% end %>
<% end %>

that's the correct synthax, working with me without problems:

for i in @news do
  if dern_cat != i.categorie then

   case i.categorie
    when bar :foo
   end

  end
end

If you still have problems post your whole code and the exact and whole errormessage you are getting!

Zouplaz wrote:

···

le 19/06/2007 13:46, Daniel Kempkens nous a dit:

Zouplaz schrieb:

Hello, there's certainly a monstrous error I don't see in :
<% for i in @news %>
<% if dern_cat != i.categorie %>
  <% case i.categorie %>
  <% end %>
<% end %>
<% end %>

I've removed all the code I could and don't understand why the case i.categorie produce a syntax error, unexpected tIDENTIFIER, expecting kWHEN

What is that syntax error ?

Thank you

The correct Syntax would be something like this (not tested):
<% for i in @news %>
<% if dern_cat != i.categorie %>
  <% case i.categorie %>
    <% when bar then foo %>
  <% end %>
<% end %>
<% end %>

I removed the 'when' statements just to have the shortest source code...
with

when 'foo'
  doit()
when 'bar'
  dont()

the error is the same

--
greets

                     one must still have chaos in oneself to be able to give birth to a dancing star

Dear Zouplaz,

it seems you opened a case-end statement and incorporated
when-end statements into it.
But the when part doesn't end in 'end', but in the next when
statement:

  case condition

    when 1

      puts "First thing."

    when 2

      puts "Second thing."

  else

      puts 'you didn\'t satisfy the condition!!!!'
  end

Best regards,

Axel

···

--
GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS.
Alle Infos und kostenlose Anmeldung: http://www.gmx.net/de/go/freemail