Programming in C#

Topics: For loop, Statement, Switch statement Pages: 4 (606 words) Published: July 24, 2013
Short-circuiting logical operators
&& and ||
OR (||) expressions – if the first evaluates as true, no need to evaluate the second operand AND (&&) expressions – if the first evaluates as false, no need to evaluate second operand C# also includes the & and | operators

logical does not perform short-circuit evaluation

* Acceptable to write an if within an if
* When block is completed, all remaining conditional expressions are skipped or bypassed * Syntax for nested if…else follows that of two-way
* Difference: With a nested if…else, the statement may be another if statement * No restrictions on the depth of nesting
Limitation comes in the form of whether you and others can read and follow your code SWITCH STATEMENT
* Multiple selection structure
* Also called case statement
* Works for tests of equality only
* Single variable or expression tested
* Must evaluate to an integral or string value
* Requires the break for any case
* No fall-through available
* Associativity
* Left-associative
* All binary operators except assignment operators
* Right-associative
* Assignment operators and the conditional operator ?
* Operations are performed from right to left
* Order changed through use of parentheses
Types of loops
* while
* Counter-controlled
* Sentinel-controlled
* State-controlled
* for
* foreach
* do…while

* Simplest and most frequently used loop
* Syntax : while (conditional expression)
* Expression – sometimes called loop condition
* Returns a Boolean result of true or false
* No semicolon after the conditional expression
* Null body→ empty bodied loop→ infinite loop
* Enclose multiple statements for body in { }

* Loop...
Continue Reading

Please join StudyMode to read the full document

You May Also Find These Documents Helpful

  • Essay about C Programming
  • programming C Essay
  • Essay on C Programming for Embedded Microcontroller Systems
  • Introduction to the C# Programming Language Essay
  • structered programming Essay
  • C++ Programming Language Essay
  • Essay about Topics in C Programming.
  • A Project Report On C Programming Essay

Become a StudyMode Member

Sign Up - It's Free