Skip to content

Commit c16524f

Browse files
authored
Misc Grammar fixes
1 parent 55eb725 commit c16524f

File tree

6 files changed

+23
-17
lines changed

6 files changed

+23
-17
lines changed

lessons/functions-in-classes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ private boolean isGamePiecePresent() {
5050
return retroReflectiveGP.get();
5151
}
5252
```
53-
Above is a example of how functions might be used. You can see that it will return a boolean of whatever the `retroReflectiveGP` sensor sees. Because it uses private, you would not be able to call this function to get weather the gp is present from outside the class.
53+
Above is a example of how functions might be used. You can see that it will return a boolean of whatever the `retroReflectiveGP` sensor sees. Because it uses private, you would not be able to call this function to get whether the gamepiece is present from outside the class.
5454

5555
```java
5656
public class Elevator extends SubsystemBase {

lessons/hello-world.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Output
2121
Hello World
2222
```
2323

24-
The code above, when run, will display "Hello World" in the terminal. Although not the most exciting result, the code to do it might look intimidating. Let's discuss what is going on here.
24+
The code above, when ran, will display "Hello World" in the terminal. Although not the most exciting result, the code to do it might look intimidating. Let's discuss what is going on here.
2525

2626
##### Curly Braces
2727
Curly braces `{}` define code blocks. There are 2 sets of them in this program. They are meant to encapsulate code within a program.
@@ -40,7 +40,7 @@ This is what you are probably thinking about when you think of code. It's what a
4040
```java
4141
System.out.println("Hello World");
4242
```
43-
What this line does it put what's between the parentheses onto the screen. In this case `"Hello World"`, which is what we see when we run the program.
43+
This line puts what's between the parentheses onto the screen. In this case, `"Hello World"`, which is what we see when we run the program.
4444

4545
At the end of every statement, we put a semicolon `;` to tell the computer that our statement is complete.
4646

lessons/logic.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Here are some comparison operators:
2525
- `||`: Or (True: `(1 == 1) || (2 != 2)`, checks if 1 is equal to 1 **or** 2 is equal to 2)
2626
- `^`: Xor (True: `(1 == 1) ^ (2 != 2)`, True if **only one** of the conditions is true)
2727

28-
### Here's some examples:
28+
### Here are some examples:
2929
```java
3030
// Reads like: "if one plus one equals two"
3131
if (1 + 1 == 2) {
@@ -42,7 +42,9 @@ if (1 + 1 == 2 && 3 + 3 == 6) {
4242
System.out.println("Math is still mathin'");
4343
}
4444
```
45-
Variables can be used in `if` statements as well, assuming that they are `boolean`'s.
45+
46+
Variables can be used in `if` statements as well, as long as they are `boolean`'s.
47+
4648
```java
4749
boolean valid = 1 == 1;
4850
if (valid) {
@@ -61,8 +63,8 @@ if (elevator.atBottomHardStop() || elevator.atUpperHardStop()) {
6163
currentMotorState = MotorState.kSTOP;
6264
}
6365
```
64-
### A Amendum for Non-Primative Types (For Those Who Care)
65-
Due to the way that java works, when you compare a non-primative type to anything else you are not comparing the value of the variable, but insted the address to the memory of the variable. Some of the consequences of this are that code like `String("abc") == "abc"` are false (String is a non primative type). For strings and others, you can do `String("abc").equals("abc")` to get it to work.
66+
### A Addendum for Non-Primative Types (For Those Who Care)
67+
Due to the way that java works, when you compare a non-primative type to anything else you are not comparing the value of the variable, but insted the address to the memory of the variable. Some of the consequences of this is that code like `String("abc") == "abc"` is false (String is a non primative type). For strings and others, you can do `String("abc").equals("abc")` to get it to work.
6668
##### For loops
6769
You can use loops to run code more than once without copy+pasting 800 lines. A straightforward way to do this is a `for` loop. `for` loops run a pre-specified amount of times, defined in the parentheses after `for`. A common syntax you will see is defining a new variable (often `i`), then setting a condition (while `i` is less than `5`), and setting a rule to be followed every loop (commonly `i++`, which increments `i` by 1).
6870

lessons/simple-functions.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,22 @@ You hopefully know what a function is from various math classes over the years.
1010

1111
![A desmos graph showing f(x) = 3x](../assets/images/desmos-graphs-simple-functions.png)
1212

13-
This function's y value is always equal to 3 times its x value. Let's see what this would look like in Java.
13+
This function's y value is always equal to 3 times its x value.
14+
15+
## Java Function
16+
17+
Let's see what that function would look like in Java.
1418

1519
```java
1620
double f(double x) {
17-
return x * 3.0;
21+
return x * 3.0d;
1822
}
1923
```
2024

2125
The first `double` represents the `return` type. This is to signify that the function `return`s a decimal value. `f` is our name. You would usually use something more descriptive such as `triple`. The `double x` is the argument, we specify type and name. It's the x in f(x). The `{ ... }` shows the inside of the function, anything in here happens when the function is 'called'. `return` is often the final line of functions. That's where you put whatever you want to come out of the function, a `double` in our case. `return` additionally ends a functions processing and 'return's to wherever you call it from. Let's see why we want a `return`.
2226

2327
```java
24-
double startNumber = 6.0;
28+
double startNumber = 6.0d;
2529

2630
double endNumber = f(startNumber); // This will evaluate to 18.0
2731
```
@@ -31,8 +35,8 @@ This hopefully explains functions. Some more examples are below:
3135
// Return the absolute value of a number
3236
double absoluteValue(double number) {
3337
double finalNumber = number
34-
if (number < 0.0) {
35-
finalNumber *= -1;
38+
if (number < 0.0d) {
39+
finalNumber *= -1.0d;
3640
}
3741
return finalNumber;
3842
}

lessons/types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Types are these indicators of, well, type. A real world example could be the typ
1313
boolean correct = true;
1414
```
1515

16-
This example's type is `boolean`. Boolean (also known as bool) values can hold either `true`, or `false`. This is seen with `= true`. Anything other than valid values on the right side of that `=` will probably cause an error. Let's go over some more simple types.
16+
This example's type is `boolean`. Boolean (also known as bool) values can hold either `true`, or `false`. This is seen with `= true`. Anything other than true or false values on the right side of that `=` will probably cause an error. Let's go over some more simple types.
1717

1818
```java
1919
int number = 3;

lessons/variables.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ This is what the value is stored to, you use this name to reference its value
2121
3. The value
2222
This is what the variable stores, it will be of the same type of the variable
2323

24-
They get arranged like so:
24+
The parts get arranged like so:
2525
```java
2626
type name = value;
2727
```
@@ -32,8 +32,8 @@ type name;
3232
```
3333
If you use this, I would expect that you give it a value soon afterwards.
3434

35-
3635
## Some Examples
36+
3737
If I wanted to make a variable called `message` with a type of `String` and a value of `Hello World` I could do the following.
3838
```java
3939
String message = "Hello World";
@@ -70,7 +70,7 @@ number = 67; // Changes number to 67
7070
System.out.println(number); // Prints 67
7171
```
7272
### Using Variables
73-
Variables are useful in that they act as their value, here's some examples of variables being used.
73+
Variables are useful in that they act as their value. Here are some examples of variables being used.
7474
```java
7575
double x = 0.4d + 12.1d; // After the =, we can put any expression that gives us a value, for example, math operations
7676

@@ -85,4 +85,4 @@ x = x + 1;
8585

8686
System.out.println(x); // Prints 2
8787
```
88-
In our next lesson we'll look at functions and how they are useful.
88+
In our next lesson we'll look at functions and how they are useful.

0 commit comments

Comments
 (0)