Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7181705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:36:47+00:00 2026-05-28T17:36:47+00:00

Can I use a Coffeescript switch block in the eco templating engine? I tried

  • 0

Can I use a Coffeescript switch block in the eco templating engine? I tried a couple of variations, but I keep getting unexpected dedent errors.

Update: To appease the downvoters, here is what I expected to work

<% switch x : %>
<% when 1 : %>
    one
<% end %>
<% when 2 : %>
    two
<% end %>
<% end %>

But I get “Parse error on line 5: unexpected dedent”

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T17:36:48+00:00Added an answer on May 28, 2026 at 5:36 pm

    ECO templates don’t appear to support the switch statement.

    The generated CoffeeScript code for your code is:

    switch x
      __out.push '\n'
      when 1
        __out.push '\n    one\n'
      __out.push '\n'
      when 2
        __out.push '\n    two\n'
      __out.push '\n'
    

    The two __out.push '\n' lines after switch x and the end of the second when statement don’t seem to allow this CoffeeScript snippet to compile into JavaScript.

    Looking through the code, I couldn’t figure out how to prevent those lines from being printed. This might be a good bug to report to the guys that make eco.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

You can use App.config; but it only supports key/value pairs. You can use .Net
I can use FlashWindowEx to make a window flash in the taskbar, but what
You can use XPath if you're binding the XML document in the XAML, but
You can use command lsof to get file descriptors for all running processes, but
I can use Server[request_time] to get current timestamp. But how would I use this
I can use urllib.request module with Python 3.1. But when I execute the same
What do I need to do so that I can use CoffeeScript in the
What are my restrictions if I want to code node.js and use CoffeeScript? Can
Eco is an embedded Coffeescript templating language. It resembles ERB. Is there a way
Is there a common Javascript/Coffeescript-specific idiom I can use to accomplish this? Mainly out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.