File: ifthen.htm

package info (click to toggle)
extrema 4.3.6-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 19,212 kB
  • ctags: 6,452
  • sloc: cpp: 86,428; sh: 8,229; makefile: 814
file content (61 lines) | stat: -rw-r--r-- 1,486 bytes parent folder | download
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
<HTML>
<HEAD>
<TITLE>Conditional statements</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">

<P><A NAME="execifthen"></A>
<font size="+3" color="green"><B>Conditional statements</B></font></P>
<P>
 <CODE>IF...THEN</CODE> statements can only
 be used in script files. The general form of an
 <CODE>IF...THEN</CODE> statement is:</p>
<p>
 <CODE>IF (boolean) THEN</CODE></P>
<P>
 The <CODE>boolean</CODE> can take any form, but
 must be enclosed in parentheses, and it must have a scalar result.  A result
 of <CODE>1</CODE> is true, while anything else is false.  An
 <CODE>IF...THEN</CODE> statement can precede a
 single command.  An <CODE>IF...THEN</CODE> statement
 can begin a block of commands, but in that case it must be terminated with an
 <CODE>ENDIF</CODE> statement.  Nested <CODE>IF...THEN</CODE> statements are allowed.</P>
<P>
 <font size="+2" color="green">Example</font></P>

 <font color="blue"><PRE>
 ...
 IF (A&gt;B) THEN TEXT 'A &gt; B'
 IF (A=B) THEN TEXT 'A = B'
 IF (A&lt;B) THEN TEXT 'A &lt; B'
 ...
 </PRE></font>

<P><font size="+2" color="green">Example</font></P>

 <font color="blue"><PRE>
 ...
 IF (A&gt;B) THEN
  ...
 ENDIF
 ...
 </PRE></font>

<P><font size="+2" color="green">Example</font></P>

 <font color="blue"><Pre>
 ...
 START2:
 IF (J&lt;=8) THEN 
  ...
  J=J+1
  GOTO START2
 ENDIF
 ...
 </PRE></font>
<P>
 <a href="looping.htm"><img src="../shadow_left.gif">&nbsp;
 <font size="+1" color="olive">Looping</font></a>
</P>
</BODY>
</HTML>