An error I can't find

Z

Zouplaz

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
 
D

Daniel Kempkens

Zouplaz said:
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 %>
 
Z

Zouplaz

le 19/06/2007 13:46, Daniel Kempkens nous a dit:
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
 
A

anansi

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!
 
A

Axel Etzold

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,158
Latest member
Vinay_Kumar Nevatia
Top