Skip to content

Commit 3c923ce

Browse files
committed
merged sections 4.1-4.4 into one section
1 parent 296cd38 commit 3c923ce

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

source/ch4_conditionals.ptx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
<chapter xml:id="conditionals">
55
<title>Conditionals</title>
66

7-
<section xml:id="simple-if">
8-
<title>Using the Simple <c>if</c> Statement</title>
7+
<section xml:id="using-conditional-in-java"> <title>Using Conditional Statements in Java</title>
98
<p><idx>conditional statements</idx>
109
Conditional statements in Python and Java are very similar.
1110
In Python we have three patterns:
@@ -50,9 +49,9 @@ if score &gt;= 90: # Note the colon at the end of the line
5049
Once again you can see that in Java the curly braces define a block rather than indentation.
5150
In Java, the parentheses around the condition are required because it is technically a function that evaluates to <c>True</c> or <c>False</c>.
5251
</p>
53-
</section>
52+
5453

55-
<section xml:id="use-the-if-else-statement">
54+
<subsection xml:id="use-the-if-else-statement">
5655
<title>Using the <c>if</c> - <c>else</c> Statement</title>
5756

5857
<p><xref ref= "python-if-else" text="type-global"/> shows how the <c>if</c> - <c>else</c>statement is written in Python.</p>
@@ -85,9 +84,9 @@ if score &gt;= 90: # Note the colon at the end of the line
8584
</code>
8685
</program>
8786
</listing>
88-
</section>
87+
</subsection>
8988

90-
<section xml:id="elif">
89+
<subsection xml:id="elif">
9190
<title>Can we use <c>elif</c>?</title>
9291

9392
<p><idx><c>elif</c> statement</idx>
@@ -172,9 +171,9 @@ public class ElseIf {
172171
</code> <tests> </tests>
173172
</program>
174173
</listing>
175-
</section>
174+
</subsection>
176175

177-
<section xml:id="switch">
176+
<subsection xml:id="switch">
178177
<title>Using the <c>switch</c> Statement</title>
179178

180179
<p>
@@ -255,6 +254,7 @@ The <c>switch</c> statement is not used very often, and we recommend you do not
255254
</p>
256255
<p>
257256
Finally, the <c>switch</c> statement does not support relational expressions such as greater than or less than. So you cannot use it to completely replace the <c>elif</c>. Even with the new features of Java 14+ the <c>switch</c> statement is still limited to constant comparisons using equality.</p>
257+
</subsection>
258258
</section>
259259

260260
<section xml:id="exception-handling">

0 commit comments

Comments
 (0)