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 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 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 Indentation Visual Studio can indent control structures properly for you. Highlight relevant code Press Ctrl-K, Ctrl-F
// 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