Stage 0: Add Java fundamentals exercises#81
Conversation
d44b835 to
d0e40bf
Compare
|
|
||
| // Create an integer variable `quotient1`, and assign to it the value | ||
| // of 5 divided by 3. Then print the value of `quotient1`. | ||
| double quotient1 = 5 / 3; |
There was a problem hiding this comment.
In 2027, WPILib has a compiler plugin that will throw a compile-time error if someone tries to do this.
So, make it an int instead (and let people know that regular java doesn't error when you do integer division like this).
There was a problem hiding this comment.
Even though it will throw an error, I still think it's valuable to showcase what happens here to better explain why there's an error and why it's problematic. Plus, I don't want to include something that's wrong in normal java, even if wpilib makes it not wrong, in a way.
There was a problem hiding this comment.
Do you mean converting quotient1 to an int is wrong, or that keeping it as a double is wrong in normal Java?
There was a problem hiding this comment.
I meant keeping it as a double, my bad.
My main concern is that this code doesn't pass CI (also, y'all got it backwards: it's wrong in WPILib java, but not in normal java).
|
🌐 Preview URL: https://pr-81.frcsoftware.pages.dev |
Description
Adds exercises for stage 0 (Java Fundamentals), to complement the stage 0 lessons being built up.
Meta
Merge checklist: