Skip to content

Commit e6af616

Browse files
committed
add comments about integer division
1 parent 72896c9 commit e6af616

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

source/ch4_conditionals.ptx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ Java also supports a <c>switch</c> statement that acts something like the <c>eli
173173
<title>Match Case Example</title>
174174
<code>
175175
grade = 85
176+
# Convert grade to a scale of 0-10 using integer division
176177
tempgrade = grade // 10
177178
def grading(tempgrade):
178179
match grade:
@@ -204,8 +205,9 @@ Java also supports a <c>switch</c> statement that acts something like the <c>eli
204205
<program xml:id="java-switch-up" interactive="activecode" language="java">
205206
<code>
206207
public class SwitchUp {
207-
public static void main(String args[]) {
208+
public static void main(String args[]) {
208209
int grade = 85;
210+
// Convert grade to a scale of 0-10 using integer division
209211
int tempgrade = grade / 10;
210212
switch(tempgrade) {
211213
case 10:
@@ -224,7 +226,7 @@ Java also supports a <c>switch</c> statement that acts something like the <c>eli
224226
default:
225227
System.out.println('F');
226228
}
227-
}
229+
}
228230
}
229231
</code> <tests> </tests>
230232
</program>

0 commit comments

Comments
 (0)