Skip to content

Commit 4630f29

Browse files
committed
added listing to text
1 parent 0c2f70c commit 4630f29

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

source/ch4_conditionals.ptx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,14 @@ if score >= 90:
8080
<p><idx><c>elif</c> statement</idx>
8181
Java does not have an <c>elif</c> pattern like Python.
8282
In Java you can get the functionality of an <c>elif</c> statement by nesting <c>if</c> and <c>else</c>.
83-
Here is a simple example in both Python and Java.
83+
Here is a simple example in both Python and Java. <xref ref="python-if-nesting" text="type-global"/> shows how it is written in Python.
8484
</p>
8585

8686
<listing xml:id="python-if-nesting">
8787
<program interactive="activecode" language="python">
8888
<code>
8989
grade = int(input('enter a grade'))
90-
if grade &lt; 60:
90+
if grade &lt; 60:
9191
print('F')
9292
elif grade &lt; 70:
9393
print('D')
@@ -102,7 +102,7 @@ else:
102102
</listing>
103103

104104
<p>
105-
In Java, we have a couple of ways to write this.
105+
In Java, we have a couple of ways to write this. <xref ref="java-ifnesting" text="type-global"/> shows one way.
106106
</p>
107107

108108
<listing xml:id="java-ifnesting">
@@ -135,7 +135,7 @@ public class ElseIf {
135135
</listing>
136136

137137
<p>
138-
We can get even closer to the <c>elif</c> statement by taking advantage of the Java rule that a single statement does not need to be enclosed in curly braces. Since the <c>if</c> is the only statement used in each <c>else</c> block, we can get away with the following.
138+
We can get even closer to the <c>elif</c> statement by taking advantage of the Java rule that a single statement does not need to be enclosed in curly braces. Since the <c>if</c> is the only statement used in each <c>else</c> block, we can get away with <xref ref="java-if-else-no-nesting" text="type-global"/>.
139139
</p>
140140

141141

0 commit comments

Comments
 (0)