Wednesday, October 26, 2011

Forms of if

The if statement can take any of the following forms:

(a) if ( condition )
do this ;

(b) if ( condition )
{
do this ;
and this ;
}

(c) if ( condition )
do this ;
else
do this ;

(d) if ( condition )
{
do this ;
and this ;
}
else
{
do this ;
and this ;
}

(e) if ( condition )
do this ;
else
{
if ( condition )
do this ;
else
{
do this ;
and this ;
}
}

(f) if ( condition )
{
if ( condition )
do this ;
else
{
do this ;
and this ;
}
}
else
do this ;

No comments:

Post a Comment