/usr/share/titan/help/info/if.html is in eclipse-titan 6.3.1-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | <!--
Copyright (c) 2000-2017 Ericsson Telecom AB
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html
Contributors:
Baji, Laszlo
Balasko, Jeno
Farkas, Laszlo
Szabados, Kristof
-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Language" content="en-us">
<title>if</title>
</head>
<body bgcolor="#DAD3C5" vlink="#0094D2" link="#003258">
<table align="left" border="0" cellspacing="0" cellpadding="0" valign=top>
<tr>
<td width=105 height=40><a href="https://projects.eclipse.org/projects/tools.titan"><img src="../images/titan_transparent.gif" border=0 width=105 height=40 align="left" alt="Titan"></a></td>
</tr>
</table>
<table border="0" align="right" cellpadding="0" cellspacing="0">
<tr>
<td><a href="../titan_main.html" alt="contents"><img border="0" src="../images/ao.jpg" width="53" height="40"></a></td>
<td><a href="../titan_index.html" alt="index"><img border="0" src="../images/up.jpg" width="53" height="40"></a></td>
<td><a href="hexstring.html" alt="previous"><img border="0" src="../images/left.jpg" width="53" height="40"></a></td>
<td><a href="ifpresent.html" alt="next"><img border="0" src="../images/right.jpg" width="53" height="40"></a></td>
</tr>
</table>
<p><br clear="all">
</p>
<hr>
<h1>if</h1>
<blockquote>
<p>1. <a href="#4.">Conditional statement with one alternative</a></p>
<p>2. <a href="#5.">Conditional statement with two alternatives</a></p>
<p>3. <a href="#5.">Conditional statement with several alternatives</a></p>
</blockquote>
<p>The conditional statement is used to branch in the program execution in function of Boolean expression. It is possible to chain more than one such branching in one program statement.</p>
<p>Related keywords:</p>
<ul>
<li><a href="else.html"><b><font face="Courier New" color="#003258" size="4">else</font></b></a></li>
</ul>
<hr align="left" width="75%">
<h4><a name="4.">1. Conditional statement with one alternative</a></h4>
<hr align="left" width="50%">
<div align="center">
<center>
<table border="0" width="90%" bgcolor="#FFB599" cellpadding="4">
<tr>
<td width="100%">
<h3 align="center"><font face="Courier New" color="#003258" size="5"><b>if(</b></font><i> condition </i><font face="Courier New" color="#003258" size="5"><b>){</b></font> <i>
statement_block </i><font face="Courier New" color="#003258" size="5"><b>};</b></font></h3>
</td>
</tr>
</table>
</center>
</div>
<ul>
<li>
<p>The <font face="Courier New" color="#003258" size="4"><b>if</b></font> keyword introduces the conditional statement.</p>
</li>
<li>
<p><i>condition</i> is a Boolean expression.</p>
</li>
<li>
<p><i>statement_block</i> contains one or more statements. The block will only be executed if the value of the preceding logical expression (<i>condition</i>) is true.</p>
</li>
</ul>
<p><a href="#Ex4">Example</a></p>
<hr align="left" width="75%" color="#0094D2">
<h4><a name="5.">2. Conditional statement with two alternatives</a></h4>
<hr align="left" width="50%" color="#0094D2">
<div align="center">
<center>
<table border="0" width="90%" bgcolor="#FFB599" cellpadding="4">
<tr>
<td width="100%">
<h3 align="center"><font face="Courier New" color="#003258" size="5"><b>if(</b></font><i> condition </i><font face="Courier New" color="#003258" size="5"><b>){</b></font> <i>
statement_block<sub>1</sub> </i><font face="Courier New" color="#003258" size="5"><b>} else {</b></font> <i> statement_block<sub>2</sub> </i><font face="Courier New" color="#003258" size="5"><b>};</b></font>
</h3>
</td>
</tr>
</table>
</center>
</div>
<ul>
<li>
<p>The <font face="Courier New" color="#003258" size="4"><b>if</b></font> keyword introduces the conditional statement .</p>
</li>
<li>
<p><i>condition</i> is a Boolean expression.</p>
</li>
<li>
<p>The <font face="Courier New" color="#003258" size="4"><b>else</b></font> keyword precedes the statement block to be executed when the <i>condition</i> is false.</p>
</li>
<li>
<p><i>statement_block<sub>1</sub></i> contains one or more statements. The block will only be executed if the value of the preceding logical expression (<i>condition</i>) is true.</p>
</li>
<li>
<p><i>statement_block<sub>2</sub></i> contains one or more statements. The block will only be executed if the value of the preceding logical expression (<i>condition</i>) is false.</p>
</li>
</ul>
<p><a href="#Ex5">Example</a></p>
<hr align="left" width="75%" color="#0094D2">
<h4><a name="5.">3. Conditional statement with several alternatives</a></h4>
<hr align="left" width="50%" color="#0094D2">
<div align="center">
<center>
<table border="0" width="90%" bgcolor="#FFB599" cellpadding="4">
<tr>
<td width="100%">
<h3 align="center"><font face="Courier New" color="#003258" size="5"><b>if(</b></font><i> condition<sub>1</sub> </i><font face="Courier New" color="#003258" size="5"><b>){</b></font> <i>
statement_block<sub>1</sub> </i><font face="Courier New" color="#003258" size="5"><b>} else if(</b></font><i> condition<sub>n</sub> </i><font face="Courier New" color="#003258" size="5"><b>){</b></font> <i>
statement_block<sub>n</sub> </i><font face="Courier New" color="#003258" size="5"><b>} else {</b></font> <i> statement_block<sub>x</sub> </i><font face="Courier New" color="#003258" size="5"><b>};</b></font>
</h3>
</td>
</tr>
</table>
</center>
</div>
<ul>
<li>
<p>The <font face="Courier New" color="#003258" size="4"><b>if</b></font> keyword introduces the conditional statement.</p>
</li>
<li>
<p><i>condition<sub>1</sub></i> is a Boolean expression.</p>
</li>
<li>
<p><i>statement_block<sub>1</sub></i> contains one or more statements. The block will only be executed if the value of <i>condition<sub>1</sub></i> is true.</p>
</li>
<li>
<p>The <font face="Courier New" color="#003258" size="4"><b>else if</b></font> keyword pair precedes the next condition (<i>condition<sub>n</sub></i>) to be checked. The keyword pair and
the following <i>condition<sub>n</sub></i> and <i>statement_block<sub>n</sub></i> may be repeated as many times as needed.</p>
</li>
<li>
<p><i>condition<sub>n</sub></i> is a Boolean expression.</p>
</li>
<li>
<p><i>statement_block<sub>n</sub></i> contains one or more statements. The block will only be executed if the value of <i>condition<sub>n</sub></i> is true AND all preceding conditions (<i>condition<sub>i</sub></i>,
where i = 1 .. n-1) are false.</p>
</li>
<li>
<p>The <font face="Courier New" color="#003258" size="4"><b>else</b></font> keyword introduces the conditional statement.</p>
</li>
<li>
<p><i>statement_block<sub>x</sub></i> contains one or more statements. The block will only be executed if the value of all preceding conditions (<i>condition<sub>i</sub></i>, where i = 1 ..
n) is false.</p>
</li>
</ul>
<p><a href="#Ex3">Example</a></p>
<hr align="left" width="50%">
<p><a name="Ex4">Example 1</a>:
<p><font face="Courier New">if (v_date == "1.1.2000") { log ( "apage" ) };</font></p>
<p>When the variable v_date equals the character string 1.1.2000, the word apage will be written to the log.</p>
<p><a name="Ex5">Example 2</a>:
<p><font face="Courier New">if (v_datum == "1.1.2000") { log ( "apage" ) } else { log ( "satanas" ) };</font></p>
<p>When the variable v_datum equals the character string 1.1.2000, the word apage, else the word satanas will be written to the log.</p>
<p><a name="Ex3">Example 3</a>:
<p><font face="Courier New">if (v_data == "red") { log ( "rot" ) } else if (v_data == "blue"){ log ( "blau" ) } else { log ( "duester" )
};</font></p>
<p>When the variable v_data equals the character string red, the word rot will be written to the log. .When the variable v_data equals the character string blue, the word blau will be written to
the log. When the variable v_data contains something else, the word duester will be written to the log. </p>
<hr align="left" width="25%">
<hr align="left" width="25%">
<p><a HREF="BNF.html#conditionalconstruct">BNF definition</a> of <font face="Courier New"> if</font></p>
</body>
</html>
|