mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 09:41:36 +00:00
Made learnc's switch statement clearer
Also cleaned up trailing whitespace.
This commit is contained in:
parent
50fe4d9859
commit
a9f51d5bbf
@ -281,10 +281,10 @@ int main() {
|
||||
// branching with multiple choices: switch()
|
||||
switch (a) {
|
||||
case 0: // labels need to be integral *constant* expressions
|
||||
//do_stuff();
|
||||
printf("Hey, 'a' equals 0!\n");
|
||||
break; // if you don't break, control flow falls over labels
|
||||
case 1:
|
||||
//do_something_else();
|
||||
printf("Huh, 'a' equals 1!\n");
|
||||
break;
|
||||
default:
|
||||
// if `some_integral_expression` didn't match any of the labels
|
||||
@ -293,7 +293,6 @@ int main() {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////
|
||||
// Typecasting
|
||||
///////////////////////////////////////
|
||||
|
Loading…
Reference in New Issue
Block a user