Discussion:
org.ibex.js switch() statement
David Crawshaw
2004-04-09 04:13:16 UTC
Permalink
This:

<ibex>
<ui:box>
var i = 5;
switch (i) {
case 5: ibex.log.info("i=5");
case 6: ibex.log.info("i=6");
}
</ui:box>
</ibex>

Produces:

Detecting JVM... Mac OS X ==> org.ibex.plat.Java2
=======================================================
Platform: Ibex build: unknown
Main: argument 0: src/
argument 1: test
loading xwar
invoking initial template
test.t:5: i=5

Should the switch() statement fall through to the next case (like
Java)? I tried to work it out from the Ecma reference, but it's not the
most accessible of documents.

-- d
Tupshin Harper
2004-04-09 04:52:28 UTC
Permalink
Post by David Crawshaw
Should the switch() statement fall through to the next case (like
Java)? I tried to work it out from the Ecma reference, but it's not
the most accessible of documents.
Yes...bug.

-Tupshin
Adam Megacz
2004-04-10 04:14:25 UTC
Permalink
Post by David Crawshaw
Should the switch() statement fall through to the next case (like
Java)?
No. But this fact should be documented in the reference. This was
deliberate.

- a
David Crawshaw
2004-04-10 04:14:18 UTC
Permalink
Post by Adam Megacz
No. But this fact should be documented in the reference. This was
deliberate.
Maybe switch statement should be like this, but it's a bit of a break
from convention, and fall-through switch statements can be useful...

-- d

Loading...