-
Notifications
You must be signed in to change notification settings - Fork 2k
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
switch-case-default over switch-when-else #785
Comments
Oh bummer, there was another ticket for this which Jeremy closed. I'll try and dig it up. EDIT: #697. |
On a related note, how about changing the subjectless compilation:
into:
|
This makes sense to me. What was the original justification for using when-else instead of JavaScript's case-default? |
Because it matches the |
OK, on further reflection, I like the way it is now. Reasons:
|
|
Coffeescript isn't Javascript, either, at least not in syntax. The switch doesn't work the same as in Javascript, so the syntax doesn't require consistency. |
OK, #3 is a good point. I'm fine with either keeping the mandatory indentation or adopting the Ruby standard, as long as there's a standard. The important thing is that we don't wind up in a situation where indentation is optional and half of folks do it one way and half do it another way. |
This isn't true as of 0.9.3.
into
No more I prefer to keep the
|
That looks like the worst of both worlds to me... if there's an |
I was referring to the fact that we insert |
Let's leave it the way it is. I see the appeal of mirroring JS syntax, but it's not as compelling as it could be, because |
I don't think so--this |
I guess I can use this indentation for now:
|
Does anybody have an Idea why this does not work? switch state
when "stateA"
console.log "we are at state stateA"
stateIndicator.innerHTML = "stateA"
when "stateB"
console.log "we are at state stateB"
stateIndicator.innerHTML = "stateB"
else
console.log "we had a weird state: " + state
stateIndicator.innerHTML = "weirdState" It gives me an Error for the line having the else: error: indentation mismatch As I would say the error message is not true^^... I know they usually are true but still I need to understand why - from this thread it appears to be the right indention - as my logic also would support |
It works fine. Generally “indentation mismatch” means you’re mixing tabs and spaces. |
OK got it thnx :-) Beware of trailing spaces!! |
Before
After
if
-else
(switch..when..then..if..then
on one line not working #562)The text was updated successfully, but these errors were encountered: