Difference between revisions of "Semicolon"

From NWN Lexicon
Jump to: navigation, search
(Created page with "=Semicolon= Semicolons are used to end a logical line in a statement. A logical line is called logical because it can span across multiple real lines to increase readabilit...")
 
m (Wikified article formatting)
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
=Semicolon=
 
 
 
Semicolons are used to end a logical line in a statement. A logical line is called logical because it can span across multiple real lines to increase readability.
 
Semicolons are used to end a logical line in a statement. A logical line is called logical because it can span across multiple real lines to increase readability.
  
<br />
+
The start and end of code block statements, with the exception of [[Code_Block_Delimiter | code block delimiter]].
  
The start and end of code block statements, with the exception of [[ Code_Block_Delimiter | code block delimiter ]].
+
<nwscript>
 +
int bCondition = TRUE; // single line statement
 +
if (bCondition)
 +
    PrintString("bCondition is TRUE."); // multiline statement
  
+
// below should be handled with "else if" instead
<font color="#0000ff">int</font> bCondition = <font color="#0000ff">TRUE</font>; <font color="#007f00">// single line statement
+
if (!bCondition)
</font><font color="#0000ff">if</font> (bCondition)
+
{
      PrintString(<font color="#00007f">"bCondition is TRUE."</font>); <font color="#007f00">// multiline statement
+
    // multiple statements in a code block
</font><font color="#007f00">// below should be handled with "else if" instead
+
     PrintString("bCondition is FALSE.");
</font><font color="#0000ff">if</font> (!bCondition)
+
    bCondition = TRUE;
{
+
}
      <font color="#007f00">// multiple statements in a code block
+
</nwscript>
</font>     PrintString(<font color="#00007f">"bCondition is FALSE."</font>);
 
      bCondition = <font color="#0000ff">TRUE</font>;
 
}
 
  
<br /><br />
 
 
----
 
----
<font color="gray">  author: Charles Feduke, editor: Jasperre, additional contributor(s): Ryan Hunt, Frank Succardi, Heikki</font><br />  <br />
+
<font color="gray">  author: Charles Feduke, editor: Jasperre, additional contributor(s): Ryan Hunt, Frank Succardi, Heikki</font>
 
[[Category:Primers]]
 
[[Category:Primers]]
 
[[Category:Basic_Scripting]]
 
[[Category:Basic_Scripting]]

Latest revision as of 23:08, 22 August 2015

Semicolons are used to end a logical line in a statement. A logical line is called logical because it can span across multiple real lines to increase readability.

The start and end of code block statements, with the exception of code block delimiter.

int bCondition = TRUE; // single line statement
if (bCondition)
    PrintString("bCondition is TRUE."); // multiline statement
 
// below should be handled with "else if" instead
if (!bCondition)
{
    // multiple statements in a code block
    PrintString("bCondition is FALSE.");
    bCondition = TRUE;
}

 author: Charles Feduke, editor: Jasperre, additional contributor(s): Ryan Hunt, Frank Succardi, Heikki