Loading content…
Loading…
Transcript

Level 5 Session 3

Else If Satement

Let's Do it

if(condition){

// statement(s) will execute if the first condition is true

}

else if(another condition){

// statement(s) will execute if the second condition is true

}

What's Next

Graduation Day

Do You Remember theVariables ?

If Statement

Variables: are used to store information to be referenced in a computer program.

Types of Variables

int :

is short for Integer and used to store nubmers like 1, 2, 3, 4, ...

double :

is short for Character and used to store single character between single qoute like 'a', 'A', ...

char :

is short for Character and used to store single character between single qoute like 'a', 'A', ...

if(Condition){

// statement(s) will execute if the condition's result is true

}

Else Statement

if(condition){

// statement(s) will execute if the condition is true

}

else{

// statement(s) will execute if the condition is false

}

Flow control

Flow control is the management of data flow between computers or devices so that the data can be handled at an efficient pace.

We are going to learn :

If statement

Else If statement

Else statement

Operations on variables

we can begin to operate with them by using operators. What follows is a complete list of operators.

  • Assignment Operator:

x = 5;

Here we assigned x with the value 5, so "=" is assign operator and "==" is the equal operator

  • Increment Operator:

x = x++;

Here we are incrementing the variable x by 1.

To increment the variable x with any number you can use x+=5; (for example)

  • Decrement Operator:

x = x--;

Here we are dncrementing the variable x by 1.

To dncrement the variable x with any number you can use x-=5; (for example)

  • Arithmetic operators ( +, -, *, /, % )

The normal operations that we use every day

+ addition

- subtraction

* multiplication

/ division

% modulo