Control Structures

?
  • Created by: mima1186
  • Created on: 16-05-16 13:15
Control Structures
One of the most basic and essential concepts in programming, allow programmers to manipulate the program
1 of 13
Control Structures 2
Once learned are easy to pick up in other languages
2 of 13
Three main Control Structures
Squence, Selection and Iteration
3 of 13
Sequential
The sequential control structure is similar to a recipe, a list of instructions in carried out in an order of one after each other
4 of 13
Selection
A selection statement causes the program control to branch to a specific flow based on whether or not a condition is true
5 of 13
Two Key Selection Constructs in C#
IF Statements and Switch Statements
6 of 13
IF Statements
Uing keywords if, else and else if: IF statement is carries out a set of statement if a condition is true and ignores if false
7 of 13
Switch Statements
Using keywords switch, case, default and break
8 of 13
Conditional Operators
== is an equivalance sign, && is a logical AND, || Is a logical OR
9 of 13
Logical Operators
== Equal If equal return true, != Not Equal If not equal return true, > Greater than If greater than return true, >= Greater than or Equal true, < Less than,
10 of 13
Switch Statement
Is a control mechanism used to allow a value of a variable or expression to control the flow of a programs execution, they are an effective way to compare one variable againest many values, easier to read a switch statement than a collection of IFs
11 of 13
Casting
After a variable is declared as a certain data type it cannot be delcared as a different data type thereafter, Sometimes though you might need to copy that value of a variable into another variable or method that expects a certain type
12 of 13
Casting 2
You can achieve this through casting also known as type conversions, Casting comes along with a complex set of rules, You can specify a cast
13 of 13

Other cards in this set

Card 2

Front

Once learned are easy to pick up in other languages

Back

Control Structures 2

Card 3

Front

Squence, Selection and Iteration

Back

Preview of the back of card 3

Card 4

Front

The sequential control structure is similar to a recipe, a list of instructions in carried out in an order of one after each other

Back

Preview of the back of card 4

Card 5

Front

A selection statement causes the program control to branch to a specific flow based on whether or not a condition is true

Back

Preview of the back of card 5
View more cards

Comments

No comments have yet been made

Similar ICT resources:

See all ICT resources »See all Systems and Software resources »