File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ if score >= 90: # Note the colon at the end of the line
6060 <program interactive =" activecode" language =" python" >
6161 <code >
6262 age = 16
63- if age > = 18:
63+ if age > = 18: # notice the semicolon
6464 print("You can vote.")
6565 else: # notice the semicolon
6666 print("You are not yet eligible to vote.")
@@ -75,7 +75,7 @@ if score >= 90: # Note the colon at the end of the line
7575 public class IfElseExample {
7676 public static void main(String[] args) {
7777 int age = 16;
78- if (age > = 18) {
78+ if (age > = 18) {
7979 System.out.println("You can vote.");
8080 } else { // else has its own block.
8181 System.out.println("You are not yet eligible to vote.");
@@ -102,7 +102,7 @@ if score >= 90: # Note the colon at the end of the line
102102grade = int(input('enter a grade'))
103103if grade < 60:
104104 print('F')
105- elif grade < 70:
105+ elif grade < 70: # notice the semicolon
106106 print('D')
107107elif grade < 80:
108108 print('C')
@@ -126,7 +126,7 @@ public class ElseIf {
126126 int grade = 85;
127127 if (grade < 60) {
128128 System.out.println('F');
129- } else {
129+ } else { // else has its own block.
130130 if (grade < 70) {
131131 System.out.println('D');
132132 } else {
@@ -160,7 +160,7 @@ public class ElseIf {
160160 int grade = 85;
161161 if (grade < 60) {
162162 System.out.println('F');
163- } else if (grade < 70) {
163+ } else if (grade < 70) { // notice how we got rid of the curly braces.
164164 System.out.println('D');
165165 } else if (grade < 80) {
166166 System.out.println('C');
You can’t perform that action at this time.
0 commit comments