[Swift-devel] [Bug 84] New: switch does not work with variable parameter
bugzilla-daemon at mcs.anl.gov
bugzilla-daemon at mcs.anl.gov
Fri Jul 27 18:46:03 CDT 2007
http://bugzilla.mcs.anl.gov/swift/show_bug.cgi?id=84
Summary: switch does not work with variable parameter
Product: Swift
Version: unspecified
Platform: Macintosh
OS/Version: Mac OS
Status: NEW
Severity: normal
Priority: P2
Component: SwiftScript language
AssignedTo: benc at hawaga.org.uk
ReportedBy: benc at hawaga.org.uk
CC: swift-devel at ci.uchicago.edu
The below code executes the default case, rather than the 8 case. Replacing the
switch with:
switch(8) {
with the selector value a hard-coded constant causes the 8 case to run.
type messagefile {}
(messagefile t) greeting(string m) {
app {
echo m stdout=@filename(t);
}
}
messagefile outfile <"091-case.out">;
int selector = 8;
print(selector);
string message;
switch(selector) {
case 3:
message="first message";
break;
case 8:
message="eighth message";
break;
case 57:
message="last message";
break;
default:
message="no message at all...";
break;
}
outfile = greeting(message);
--
Configure bugmail: http://bugzilla.mcs.anl.gov/swift/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
More information about the Swift-devel
mailing list