Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If/else and Switch operator #40

Open
boolka opened this issue Apr 26, 2014 · 2 comments
Open

If/else and Switch operator #40

boolka opened this issue Apr 26, 2014 · 2 comments

Comments

@boolka
Copy link

boolka commented Apr 26, 2014

Do not understand, but i have errors, while use switch or if/else op...
Somethin like this :
<% switch ( state ) { %>
   <% case 0: %>
    

some text


   <% break; %>
   <% case 1: %>
     

another one


   <% break; %>
<% } %>
or this :
<% if (state == 0) { %>
  

First state


<% } %>
<% else if (state == 1) { %>
  

Second state


<% } %>
but simple 'if' op is works
Error: " SyntaxError: Unexpected token ; "

@TravestyDesigns
Copy link

This is a really old issue, but if you are still having this issue, from my experience you need to group the closing bracket with the else like so <% } else { %> instead of <% } %> <% else { %>

@angrykoala
Copy link

same here:

<%switch (item.tipo) { %>
<%case 1:%>

won't work while

<%switch (item.tipo) {
case 1:%>

works fine (independently of the rest of the code)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants