mirror of
https://github.com/ChaiScript/ChaiScript.git
synced 2025-12-06 16:57:04 +08:00
Merge pull request #438 from RobLoach/patch-1
Add Switch Statement example
This commit is contained in:
commit
b9a5607a56
@ -370,6 +370,25 @@ if (expression) { }
|
||||
if (statement; expression) { }
|
||||
```
|
||||
|
||||
## Switch Statements
|
||||
|
||||
``` chaiscript
|
||||
var myvalue = 2
|
||||
switch (myvalue) {
|
||||
case (1) {
|
||||
print("My Value is 1");
|
||||
break;
|
||||
}
|
||||
case (2) {
|
||||
print("My Value is 2");
|
||||
break;
|
||||
}
|
||||
default {
|
||||
print("My Value is something else.";
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Built in Types
|
||||
|
||||
```
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user