Stage 0: Conditionals#40
Conversation
CodeMyGame1
left a comment
There was a problem hiding this comment.
Mostly good, just left comments on formatting and grammar. My apologies for the nitpicking 😭
813ea0d to
7043aa5
Compare
|
🌐 Preview URL: https://pr-40.frcsoftware.pages.dev |
b5680fd to
6ca05c8
Compare
ea813ca to
f514f00
Compare
| In everyday life, we make decisions based on different situations. | ||
| Such as "If we are hungry, then we get a snack" or "If we are tired, we go to bed". | ||
| Often in code, we want our program to do something similar and make different decisions based on different situations. | ||
| For robots, this could be Often in code, we want our program to do something similar and make different decisions based on different situations. |
There was a problem hiding this comment.
This sentence reads weirdly, Often should be lowercase too
| As a reminder, a keyword is a reserved word that the compiler uses to run the code. | ||
| In Java, we use the following keywords for conditionals: if, else, and else if | ||
|
|
||
| ## If |
There was a problem hiding this comment.
Should match same capitalization as other section titles (else if and else both being lowercase)
| Our example code has the robot drive at full speed if the distance is greater than 10cm, has the robot drive at half speed if the distance is less than 10cm, but the robot never stops if it reaches its target distance. | ||
| You could add another else if, or you could add an else conditional. | ||
|
|
||
| ## else |
There was a problem hiding this comment.
Should probably put else above else if? Even though in an actual if statement they're in this order, covering the concept of else before extending it to else if makes more sense I think
| Let's break down what this new addition means. | ||
| else if is a keyword that allows the conditional to run a different task if the if statement is false. | ||
|
|
||
| If `Condition_A` is true then the code inside the if statement will run. |
There was a problem hiding this comment.
Similar note to the other PR, but these variables should all be lowercased and follow normal naming convention (also requires changing the code examples)
| ``` | ||
|
|
||
| else statements do not have parentheses because they do not have a condition. | ||
| If Condition is true, then the code inside the if statement will run. |
There was a problem hiding this comment.
Condition here should be lowercase to match the code
Added page about conditional statements
This includes: If, else if, else. Switch isn't included for now as discussed on Discord
Exercises will be added in later as it's being covered by #32