Control Statement ;
> control statement are used to control the flow of the execution of the program .> control statement can be divided into three categories.
1. Conditional control statement
2. Repetitional control statement
3. Jump control statement
# Conditional control statement ;
@ if statement
1. syntax : if (condition)
statement :
2. syntax : if (condition)
{
statement 1 ;
statement 2 ;
'
'
}
@ if else statement
1. syntax; if (condition)
{
statement ;
'
'
}
else
{
statement ;
'
'
}
@ switch statement
syntax ; switch ( conditional variable )
{
case value 1 ;
statement ;
break ;
case value 2 ;
statement ;
break ;
'
'
'
default :
statement ;
}
# Repetitional control statement ;
@ while statement
syntax ; while (condition)
{
statement ;
'
'
'
}
@ for statement
syntax ; for ( variable initialization : condition ; increment or decrement )
{
statement 1 ;
'
'
'
}
@ do while statement
syntax : do
{
statement 1 ;
'
'
'
} while (condition) ;
# Jump control statement
@ break statement
syntax ; break ;
@ continue statement
syntax : continue ;
@ if go to statement
syntax : go to lablename ;
No comments:
Post a Comment