Skip to content

Commit ebaaf16

Browse files
committed
changed wording
1 parent 2b1f682 commit ebaaf16

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

source/ch4_conditionals.ptx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ The <c>switch</c> statement is not used very often, and we recommend you do not
298298
</listing>
299299

300300
<p>
301-
This code works well, but will end with an exception if the user types anything other than a whole number (such as 12.5 or two). If we wanted to ensure the code will continue to run until the user enters the correct format, we could add <c>try-except</c> (Python) or <c>try-catch</c> (Java) blocks within a <c>while</c> loop that iterates until the user enter the correct code. <xref ref="python-square-input-exception" text="type-global"/> shows how adding <c>try-except</c> blocks and a <c>while</c> loop to the Python code will look.
301+
This code works well, but will end with an exception if the user types anything other than a whole number (such as 12.5 or two). If we wanted to ensure the code will continue to run until the user enters the correct format, we could add <c>try-except</c> (Python) or <c>try-catch</c> (Java) blocks within a <c>while</c> loop that iterates until the user enter the correct code. While try-except blocks aren't strictly required in Python, <xref ref="python-square-input-exception" text="type-global"/> shows how using them alongside a while loop makes the code more robust.
302302
</p>
303303
<listing xml:id="python-square-input-exception">
304304
<program interactive="activecode" language="python">

0 commit comments

Comments
 (0)