Skip to content

Commit a7ba8c4

Browse files
committed
add missing close brackets on else if
1 parent bdcf1b4 commit a7ba8c4

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

‎source/Java4Python.rst‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -611,8 +611,9 @@ more of a user interface to them than reading and writing from the
611611
command line. Lets look at a version of our temperature control
612612
application that uses dialog boxes for input and output.
613613

614-
::
615-
614+
.. livecode:: swing
615+
:language: java
616+
:sourcefile: TempConvGUI.java
616617

617618
import javax.swing.*;
618619

@@ -1131,7 +1132,7 @@ simple example in both Python and Java.
11311132
.. activecode:: pyelif
11321133
:language: python
11331134

1134-
grade = input('enter a grade')
1135+
grade = int(input('enter a grade'))
11351136
if grade < 60:
11361137
print 'F'
11371138
elif grade < 70:
@@ -1152,8 +1153,8 @@ In Java we have a couple of ways to write this
11521153
public class ElseIf {
11531154
public static void main(String args[]) {
11541155
int grade = 85;
1155-
1156-
if (grade < 60>) {
1156+
1157+
if (grade < 60) {
11571158
System.out.println('F');
11581159
} else {
11591160
if (grade < 70) {
@@ -1167,7 +1168,10 @@ In Java we have a couple of ways to write this
11671168
} else {
11681169
System.out.println('F');
11691170
}
1171+
}
1172+
}
11701173
}
1174+
}
11711175
}
11721176

11731177
We can get even closer to the elif statement by taking advantage of the

0 commit comments

Comments
 (0)