* remove "\r" nonsense
[mascara-docs.git] / C / the.ansi.c.programming.language / notes.accompany.ansi.c / sx6b.html
blobb4c59733461c1347cea467922b8ad1f93cd3192a
1 <!DOCTYPE HTML PUBLIC "-//W3O//DTD W3 HTML 2.0//EN">
2 <!-- This collection of hypertext pages is Copyright 1995, 1996 by Steve Summit. -->
3 <!-- This material may be freely redistributed and used -->
4 <!-- but may not be republished or sold without permission. -->
5 <html>
6 <head>
7 <link rev="owner" href="mailto:scs@eskimo.com">
8 <link rev="made" href="mailto:scs@eskimo.com">
9 <title>section 3.2: If-Else</title>
10 <link href="sx6a.html" rev=precedes>
11 <link href="sx6c.html" rel=precedes>
12 <link href="sx6.html" rev=subdocument>
13 </head>
14 <body>
15 <H2>section 3.2: If-Else</H2>
17 <p>The syntax description here may seem to suggest
18 that <I>statement</I><tt>&lt;sub&gt;</tt>1<tt>&lt;/sub&gt;</tt> and <I>statement</I><tt>&lt;sub&gt;</tt>2<tt>&lt;/sub&gt;</tt>
19 must be single, simple statements,
20 but,
21 as mentioned
22 in section 3.1,
23 a block of statements enclosed in braces <TT>{}</TT>
24 is equivalent to a single statement.
25 </p><p>page 56
26 </p><p>``Coding shortcuts''
27 like
28 <pre> if(expression)
29 </pre>can indeed be cryptic,
30 but they're also quite common,
31 so you'll need to be able to recognize them
32 even if you don't choose to write them in your own code.
33 Whenever you see code like
34 <pre> if (x)
35 </pre>or
36 <pre> if (f())
37 </pre>where <TT>x</TT> or <TT>f()</TT>
38 do not have obvious ``Boolean'' names,
39 just mentally add in
40 <TT>!= 0</TT>.
41 </p><p>Don't worry too much if the multiple <TT>if</TT>/<TT>else</TT> ambiguity
42 described on page 56
43 doesn't make perfect sense;
44 just note the deep sentence:
45 <blockquote>...it's a good idea to use braces when there are nested <TT>if</TT>s.
46 </blockquote></p><hr>
47 <p>
48 Read sequentially:
49 <a href="sx6a.html" rev=precedes>prev</a>
50 <a href="sx6c.html" rel=precedes>next</a>
51 <a href="sx6.html" rev=subdocument>up</a>
52 <a href="top.html">top</a>
53 </p>
54 <p>
55 This page by <a href="http://www.eskimo.com/~scs/">Steve Summit</a>
56 // <a href="copyright.html">Copyright</a> 1995, 1996
57 // <a href="mailto:scs@eskimo.com">mail feedback</a>
58 </p>
59 </body>
60 </html>