Download as pdf or txt
Download as pdf or txt
You are on page 1of 21

CODING CAMP TRAINERS

Data Types

Operator (Arithmetic,Relational, Logical, Compound)

Method
MATERIAL Condition

Array

Looping
int
long
float
DATA TYPES double
bool
char
string

3
4
+
-
ARITHMETIC /

OPERATOR *
%

5
==
>

RELATIONAL <
>=
OPERATORS <=
!=

6
LOGICAL OPERATOR
Operand 1 Operand 2 And (&&) Or (||)

True True True True

True False False True

False True False True

False False False False

7
COMPUND ASSIGNMENT OPERATORS
Operator Operator Name Example Equivalent To

Addition
+= x += 5 x=x+5
Assignment

Subtraction
-= x -= 5 x=x-5
Assignment

Multiplication
*= x *= 5 x=x*5
Assignment

/= Division Assignment x /= 5 x=x/5

%= Modulo Assignment x %= 5 x=x%5

8
9
VOID VS NON-VOID
Void Non-Void
No return Have return
No data type at declaration There’s a datatype at
declaration
Using keyword void Don’t using keyword void

10
11
IF Else
If (condition)
{
Statement
} else if (condition) {

IF ELSE Statement
} else {
Statement
}

Check All One by One, then execute.

12
Switch Case
Switch (condition)
{
Case 1:
Statement;
Break;
}

SWITCH CASE Case 2:


Statement;
Break ;
}
Default:
Statement;
Break

Directly execute code at the right condition.

13
14
Arrays are used to store multiple values in a single variable, instead of declaring
separate variables for each value.

15
17
FOR

Executes A Statement Or A Block


Of Statements Repeatedly Until A
Specified Expression Evaluates to
False. There is need to specify the
loop bounds (minimum or
maximum).

18
FOREACH

The foreach statement


repeats a group of
embedded statements for
each element in an array or
an object collection. You do
not need to specify the loop
bounds minimum or
maximum. The following
code loops through all items
of an array.

19
While (condition){
Statement
};

WHILE

Checked first, then run the code.

20
Do{
statement
}while (condition);

DO WHILE

Run first, then check condition.

21
https://www.c-sharpcorner.com/blogs/difference-
REFERENCES between-for-and-foreach-loop-in-c-sharp1

22

You might also like