Comments (7)
ideally I'd like to keep compatibility with Javascript. Perhaps there's
another way ?
On Tue, Jun 21, 2011 at 5:36 AM, benekastah <
[email protected]>wrote:
And when this is fixed, it would also be nice if
break
statements
aren't required. They're silly. I would like something like:switch foo { case :bar: aha() case :batz: doSomething() fallthrough default bar() }
Just an idea.
Reply to this email directly or view it on GitHub:
#36
from kaffeine.
There's always the ruby way. That's the best variation of the switch I've used.
// this is only ruby-ish
case thing {
when 'rock', 'roll'
rockNRoll()
else
goHome()
beSad()
}
Then if you really need to use the fallthrough capability, you can just write your switch in pure js.
from kaffeine.
how about
switch thing
when 'rock', 'roll':
rockNRoll()
else:
beSad()
? do we want/need the colons ?
On Tue, Jun 21, 2011 at 8:31 AM, benekastah <
[email protected]>wrote:
There's always the ruby way. That's the best variation of the switch I've
used.case thing when 'rock', 'roll' rockNRoll() else beSad()
Reply to this email directly or view it on GitHub:
#36 (comment)
from kaffeine.
Yeah, I actually kind of like the colons. It's a little more javascripty, and they help me a bit visually.
from kaffeine.
yeah agreed.
maybe we don't need the else as it doesn't add anything beyond 'default' ?
On Tue, Jun 21, 2011 at 8:41 AM, benekastah <
[email protected]>wrote:
Yeah, I actually kind of like the colons. It's a little more javascripty,
and they help me a bit visually.Reply to this email directly or view it on GitHub:
#36 (comment)
from kaffeine.
True. default
would be better in this context.
from kaffeine.
ok so :
switch thing {
when 'rock', 'roll':
rockNRoll()
when 'jazz':
jazz()
default:
beSad()
}
which is converted to :
switch(thing) {
case 'rock':
rockNRoll(); break; case 'roll': rockNRoll(); break;
case 'jazz':
jazz(); break;
default:
beSad()
}
On Tue, Jun 21, 2011 at 8:46 AM, benekastah <
[email protected]>wrote:
True.
default
would be better in this context.Reply to this email directly or view it on GitHub:
#36 (comment)
from kaffeine.
Related Issues (20)
- Horrible nodejs support HOT 4
- npm install issues
- errs out on switch statement
- for own key in { ... } HOT 15
- "foo['batz']! someArgs" results in Error HOT 2
- @__define(G/S)etter__ doesn't work HOT 1
- Integrate in Express? HOT 4
- Error with double parentheses HOT 4
- Function syntax is ambiguous HOT 3
- Async bug? HOT 3
- Switch/Case bug
- Cannot find module 'optparse' HOT 1
- do/while loops fail to parse
- is this project dead? HOT 9
- Webpage Documentation doesn't seem to match current version HOT 2
- pipe can be used as a variable name HOT 3
- Is there operator overloading HOT 2
- `knode` error
- Support ES6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kaffeine.