Difference between revisions of "SHIP:Sail:Flow Control:else"

From Serious Documentation
Jump to: navigation, search
(Created page with "== See Also == *Sail Home *Flow_Control == {{SHIP:Sail:Flow_Control|else}} == <onlyinclude>Branch control to follow the {{Reserved|fa...")
 
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
== See Also ==
 
== See Also ==
 
*[[SHIP:Sail|Sail Home]]
 
*[[SHIP:Sail|Sail Home]]
*[[SHIP:Sail:Flow_Control|Flow_Control]]
+
*[[SHIP:Sail:Flow_Control|Flow Control]]
 +
*[[SHIP:Sail:Flow_Control:if|if]]
  
== {{SHIP:Sail:Flow_Control|else}} ==
+
== [[SHIP:Sail:Flow_Control|else]] ==
 
<onlyinclude>Branch control to follow the {{Reserved|false}} branch of execution.
 
<onlyinclude>Branch control to follow the {{Reserved|false}} branch of execution.
  
Line 10: Line 11:
 
! scope="col" style="text-align:left" | Description
 
! scope="col" style="text-align:left" | Description
 
|-
 
|-
|{{Flow_Control|else}}||Code execution for the false expression path of the if statement.
+
|[[SHIP:Sail:Flow_Control|else]]||Code execution for the false expression path of the if statement.
 
|}</onlyinclude>
 
|}</onlyinclude>
 
== Example ==
 
== Example ==
<code>
+
<source lang="c">
 
if (expresstion)
 
if (expresstion)
 
   statement;
 
   statement;
 
else
 
else
 
   statement;
 
   statement;
</code>
+
</source>
  
 
or
 
or
  
<code>if (expression)
+
<source lang="c">
{
+
if (expression) {
 
   statement 1;
 
   statement 1;
 
   ...
 
   ...
 
   statement n;
 
   statement n;
 
}
 
}
else
+
else {
{
 
 
   block of statements;
 
   block of statements;
}</code>
+
}</source>
 +
 
 +
[[Category:Flow Control]]

Latest revision as of 13:28, 10 October 2016

See Also

else

Branch control to follow the false branch of execution.

Statement Description
else Code execution for the false expression path of the if statement.

Example

if (expresstion)
   statement;
else
   statement;

or

if (expression) {
   statement 1;
   ...
   statement n;
}
else {
   block of statements;
}