Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Chap 4. Data Should know Declare & Initialize variables Declare constants Assignment Operators Increment and Decrement Operators Precedence of Operators.

Similar presentations


Presentation on theme: "1 Chap 4. Data Should know Declare & Initialize variables Declare constants Assignment Operators Increment and Decrement Operators Precedence of Operators."— Presentation transcript:

1 1 Chap 4. Data Should know Declare & Initialize variables Declare constants Assignment Operators Increment and Decrement Operators Precedence of Operators Escape characters More on type casting/conversion in examples coming up AND READ Fig 6.19 and Section 5.11!

2 2 Chap 5-6. Control Structures Program of control Sequential execution Selection structure The if and if/else statements Switch statement The goto statement Repetition structures The while and do/while loops (chapter 5) The for and foreach loops (chapter 6, 8) Powerpoint slides modified from Deitel & Deitel

3 3 Conditional Operator (?:) C#’s only ternary operator Similar to an if/else structure The syntax is: (boolean value ? if true : if false) Example: Console.WriteLine (grade >= 60 ? “Passed” : “Failed”);

4 4 Indentation Visual Studio can indent control structures properly for you. Highlight relevant code Press Ctrl-K, Ctrl-F

5 // do-while repetition // initialization of loop counter counter= 1; // do 10 times do { // output counter Console.Write (counter); ++counter; } while ( counter <= 10 ) ; Console.WriteLine ( ); Blank line Program Output 1 2 3 4 5 6 7 8 9 10


Download ppt "1 Chap 4. Data Should know Declare & Initialize variables Declare constants Assignment Operators Increment and Decrement Operators Precedence of Operators."

Similar presentations


Ads by Google