3 statements and operators
TRANSCRIPT
![Page 2: 3 statements and operators](https://reader033.vdocuments.net/reader033/viewer/2022052618/554bb198b4c905b8618b5a7e/html5/thumbnails/2.jpg)
Types of Statements
Selection
| if, else, switch, case
Iteration
| for, foreach, while
Jump
| break, continue, default, goto, return, yield
Exception Handling
| throw, try-catch, try-finally, try-catch-finally
Checked and Unchecked
Fixed
| fixed, unsafe
Lock
![Page 3: 3 statements and operators](https://reader033.vdocuments.net/reader033/viewer/2022052618/554bb198b4c905b8618b5a7e/html5/thumbnails/3.jpg)
Types of Operators
![Page 4: 3 statements and operators](https://reader033.vdocuments.net/reader033/viewer/2022052618/554bb198b4c905b8618b5a7e/html5/thumbnails/4.jpg)
Types of Operators
Arithmetic
Relational
Logical
Conditional
Increment and Decrement
Assignment
![Page 5: 3 statements and operators](https://reader033.vdocuments.net/reader033/viewer/2022052618/554bb198b4c905b8618b5a7e/html5/thumbnails/5.jpg)
Arithmetic Operators
are binary operators.
![Page 6: 3 statements and operators](https://reader033.vdocuments.net/reader033/viewer/2022052618/554bb198b4c905b8618b5a7e/html5/thumbnails/6.jpg)
Relational Operators
![Page 7: 3 statements and operators](https://reader033.vdocuments.net/reader033/viewer/2022052618/554bb198b4c905b8618b5a7e/html5/thumbnails/7.jpg)
Logical Operators Boolean Logical Operators
Bitwise Logical Operators
![Page 8: 3 statements and operators](https://reader033.vdocuments.net/reader033/viewer/2022052618/554bb198b4c905b8618b5a7e/html5/thumbnails/8.jpg)
Bitwise Logical Operators Boolean Logical Operators
http://pastebin.com/BuXr5Zxq
AND
![Page 9: 3 statements and operators](https://reader033.vdocuments.net/reader033/viewer/2022052618/554bb198b4c905b8618b5a7e/html5/thumbnails/9.jpg)
Conditional Operators
AND (&&) evaluates the second expression only if the first one return true. https://gist.github.com/2318365
OR (||) evaluates the second expression only if the first one return false. https://gist.github.com/2318398
![Page 10: 3 statements and operators](https://reader033.vdocuments.net/reader033/viewer/2022052618/554bb198b4c905b8618b5a7e/html5/thumbnails/10.jpg)
Increment and Decrement Operators
![Page 11: 3 statements and operators](https://reader033.vdocuments.net/reader033/viewer/2022052618/554bb198b4c905b8618b5a7e/html5/thumbnails/11.jpg)
Assignment Operators
![Page 12: 3 statements and operators](https://reader033.vdocuments.net/reader033/viewer/2022052618/554bb198b4c905b8618b5a7e/html5/thumbnails/12.jpg)
Precedence and Associativity
![Page 13: 3 statements and operators](https://reader033.vdocuments.net/reader033/viewer/2022052618/554bb198b4c905b8618b5a7e/html5/thumbnails/13.jpg)
Data Conversions
![Page 14: 3 statements and operators](https://reader033.vdocuments.net/reader033/viewer/2022052618/554bb198b4c905b8618b5a7e/html5/thumbnails/14.jpg)
Typecasting
![Page 15: 3 statements and operators](https://reader033.vdocuments.net/reader033/viewer/2022052618/554bb198b4c905b8618b5a7e/html5/thumbnails/15.jpg)
Implicit typecasting (Coercion) refers to an automatic conversion of data type
done when the destination data types belong to the same hierarchy and the destination data type must hold a larger range of values than the source data type
https://gist.github.com/2318445
![Page 16: 3 statements and operators](https://reader033.vdocuments.net/reader033/viewer/2022052618/554bb198b4c905b8618b5a7e/html5/thumbnails/16.jpg)
Implicit typecasting (Coercion)
![Page 17: 3 statements and operators](https://reader033.vdocuments.net/reader033/viewer/2022052618/554bb198b4c905b8618b5a7e/html5/thumbnails/17.jpg)
Explicit typecasting refers to changing a data type of higher precision into a data type of lower precision.
the destination data type hold a smaller range of values than the source data type
<tager data type> <variable name> = (target data type) <source data type>;
https://gist.github.com/2318452
![Page 18: 3 statements and operators](https://reader033.vdocuments.net/reader033/viewer/2022052618/554bb198b4c905b8618b5a7e/html5/thumbnails/18.jpg)
Explicit typecasting using built-in method System.Convert class
Convert.ToChar(float)
ToString() method
https://gist.github.com/2318468
![Page 19: 3 statements and operators](https://reader033.vdocuments.net/reader033/viewer/2022052618/554bb198b4c905b8618b5a7e/html5/thumbnails/19.jpg)
Boxing converting a value type to its reference type.
![Page 20: 3 statements and operators](https://reader033.vdocuments.net/reader033/viewer/2022052618/554bb198b4c905b8618b5a7e/html5/thumbnails/20.jpg)
Unboxing converting a reference type to a value type
![Page 22: 3 statements and operators](https://reader033.vdocuments.net/reader033/viewer/2022052618/554bb198b4c905b8618b5a7e/html5/thumbnails/22.jpg)
Question?
What is the result of the following code snippets?
https://gist.github.com/2318553
![Page 23: 3 statements and operators](https://reader033.vdocuments.net/reader033/viewer/2022052618/554bb198b4c905b8618b5a7e/html5/thumbnails/23.jpg)
Question?
What is the result of the following code snippets?
https://gist.github.com/2318553