Cheatography
https://cheatography.com
Data Typesbool | Boolean Value | int | Integer (32 Bit) | string | String Value | float | Integer with Decimal (32 Bit) | double | Integer with Decimal (64 Bit) |
Declaring Variables:
DataType variableName = value;
Examples:
string mySchool = "Pacific Hills Christian School";
int myPostcode = 2158;
bool gameOver = false;
Type Conversion MethodsConvert.ToInt32 | Convert.ToDouble | Convert.ToString |
Example:
playerguess = Convert.ToInt32(Console.ReadLine());
Arraysint[] array = new int[] {1, 2, 3} | int[] array = {1, 2, 3} | var array = new int[] {1, 2, 3} | int[] array = new int[3] |
Examples:
Declaring:
string[] PHCS = {"Quarry Rd", "Dural"};
Assigning
PHCS[0] = "9-14 Quarry Rd"
Accessing
Console.WriteLine(PHCS[1])
| | Statementsif-else | if (true) {...} else if (true) {...} else {...} | switch | switch (var) { case 1: break; default: break; } | for | for (int i =1; i < 5; i++) {...} | foreach-in | foreach (int item in array) {...} | while | while (true) {...} | do... while | do {...} while (true); | try-catch-finally | try {...} catch (Exception e) {...} catch {...} finally {...} |
Arithmetic Operators+ | Add Numbers | - | Subtract Numbers | * | Multiply Numbers | / | Divide Numbers | % | Compute remainder of division of numbers | ++ | Increase integer value by 1 | -- | Decreases integer value by 1 |
Comparison Operators< | Less than | > | Greater than | <= | Less than or equal to | => | Greater than or equal to | == | Equal to | != | Not Equal to |
|
Help Us Go Positive!
We offset our carbon usage with Ecologi. Click the link below to help us!
Created By
Metadata
Favourited By
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets