Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions source/ch4_conditionals.ptx
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ if score >= 90:
<section xml:id="use-the-if-else-statement">
<title>Using the <c>if</c> - <c>else</c> Statement</title>

<p>The Java equivalent follows the same syntactical rules as before.</p>
<program xml:id="python-if-else" interactive="activecode" language="python">
<p><xref ref= "python-if-else" text="type-global"/> shows how the <c>if</c> - <c>else</c>statement is written in Python.</p>
<listing xml:id="python-if-else">
<program interactive="activecode" language="python">
<code>
age = 16
if age &gt;= 18:
Expand All @@ -57,8 +58,11 @@ if score &gt;= 90:
print("You are not yet eligible to vote.")
</code>
</program>

<program xml:id="java-if-else" language="java">
</listing>

<p> <xref ref="java-if-else" text="type-global"/> is Java equivalent that follows the same syntactical rules as before.</p>
<listing xml:id="java-if-else">
<program interactive="activecode" language="java">
<code>
public class IfElseExample {
public static void main(String[] args) {
Expand All @@ -72,6 +76,7 @@ if score &gt;= 90:
}
</code>
</program>
</listing>
</section>

<section xml:id="elif">
Expand Down