diff --git a/source/ch4_conditionals.ptx b/source/ch4_conditionals.ptx index 0b32d00..91dd65a 100644 --- a/source/ch4_conditionals.ptx +++ b/source/ch4_conditionals.ptx @@ -13,20 +13,26 @@

- In Python the simple if statement is written as: + shows how the simple if statement is written in Python.

- + + score = 95 if score >= 90: print("Excellent work!") + + +

In Java, this same pattern requires two changes: the condition must be in parentheses (), and the code block must be enclosed in curly braces {}. + shows how the simple if statement is written in Java.

- + + public class SimpleIfExample { public static void main(String[] args) { @@ -38,6 +44,8 @@ if score >= 90: } + +

Once again you can see that in Java the curly braces define a block rather than indentation. In Java, the parentheses around the condition are required because it is technically a function that evaluates to True or False.