Download presentation
Presentation is loading. Please wait.
Published byBuddy Williams Modified over 9 years ago
1
The C# language fundamentals ( II ) Po Feng, Tsai
2
Switch statements An alternative to nested ifs Similar to Matlab
4
The goto and break keywords The switch statement Fall through Goto Move to another address with specified label Create a label and the goto the label Break Jump out of the switch statement Averting from using goto is strongly suggested Complicating your codes
5
Fall through you cannot fall through to the next case if the case statement is not empty
6
Loops The while loop Example
7
Exercise 7 Please try to use the while loop to print the following message * ** *** **** ***** Debugger
8
Loops The do … while loop Example
9
Loops The for loop Example remainder
10
Exercise 8 Please try to use the for loop to print the following message * ** *** **** *****
11
Continue & Break The continue statement causes the loop to return to the top and continue executing The break statement causes the loop to stop and jump out of executing block Example
12
Alarm system (3-15)
13
Exercise 9 Please implement a multiplication table (3x9) with any of the loops mentioned above
14
The ternary operator Usage Example
15
Preprocessor Directives Before your code is compiled, another program called the preprocessor runs and prepares your program for the compiler begin with the pound sign (#) Usually for debugging purpose
16
Example 1
17
Example 2
18
#region Used to mark off areas of code and collapse them Paired with #endregion Additional information can be attached right after the label
19
Click here
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.