Skip to content
Open
Show file tree
Hide file tree
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
7 changes: 4 additions & 3 deletions pretext/Control_Structures/conditionals.ptx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?xml version='1.0' encoding='UTF-8'?>
<section xml:id="control_-structures_conditionals">
<title>Conditionals</title>
<p>Conditional statements in Python and C++ are very similar.</p>
<subsection xml:id="control_-structures_simple-if">
<introduction>
<p>Conditional statements in Python and C++ are very similar.</p>
</introduction>
<subsection xml:id="control_-structures_simple-if">
<title>Simple if</title>
<p>In Python, we write a simple if statement in the following way:</p>
<pre>if condition:
Expand Down
7 changes: 4 additions & 3 deletions pretext/Control_Structures/for_loop.ptx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<section xml:id="control_-structures_for-loops">
<title>For Loops</title>
<p>Even though the <c>while</c> type of construct is very useful in a wide variety of
<introduction>
<p>Even though the <c>while</c> type of construct is very useful in a wide variety of
situations, another iterative structure, the <c>for</c> <idx> <c> for </c> </idx> statement, can be
used to iterate across a range of values easily.
A <c>for</c> statement allows us to write a loop that is executed a specific number of times.</p>
Expand Down Expand Up @@ -41,7 +41,8 @@ using namespace std;
<p>The code will use <c>cout</c> five times. The value of the variable <c>i</c> will
start at 0 and go through the full sequence of values 0,1,2,3,4. This
value is then squared and printed.</p>
<subsection xml:id="control_-structures_check-yourself">
</introduction>
<subsection xml:id="control_-structures_check-yourself">
<title>Check yourself</title>
<pre>#include &lt;iostream&gt;
using namespace std;
Expand Down