Skip to content

Commit ad51c9a

Browse files
committed
fix: update old link to new website in tutorials (if-else and boolean to if and Boolean)
1 parent 2533fb4 commit ad51c9a

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/content/tutorials/en/color-gradients.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ This tutorial uses the [p5.js Web Editor](https://editor.p5js.org/) and is desig
5858
- See this [example sketch](https://editor.p5js.org/Msqcoding/sketches/mLfhMChZW) that sets up your webcam to display on the canvas. 
5959
- Visit the p5.reference pages for [`.position()`](/reference/p5.Element/position) and [`p5.Element`](/reference/p5/p5.Element) to learn more.
6060
- Create a function to take a snapshot with your webcam.
61-
- Declare a global [Boolean](/reference/p5/boolean) variable called `snapped` and assign it a value of `false`.
61+
- Declare a global [Boolean](/reference/p5/Boolean) variable called `snapped` and assign it a value of `false`.
6262
- This variable will keep track of when a snapshot is taken and is known as a [state](https://developer.mozilla.org/en-US/docs/Glossary/State_machine) variable.
6363
- Visit the MDN glossary for [state machine](https://developer.mozilla.org/en-US/docs/Glossary/State_machine) for more information about states.
6464
- Define a function called `takeSnap()` below your `setup()` function.

src/content/tutorials/en/conditionals-and-interactivity.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ if (sunHeight < horizon) {
471471

472472
In the code above, we see that if the sun is above the horizon, `sunHeight < horizon `returns `true`, and the code `background("lightblue")` runs. When `sunHeight` is NOT less than the horizon the code block after the `else` keyword, `background(0)`, runs. Although both ways of writing the code have the same visual effect, sometimes it can be clearer and more efficient to use if-else, especially when two different code blocks can be controlled. 
473473

474-
Visit the p5.js reference page for [`if`](/reference/p5/if-else) and [`Boolean`](/reference/p5/boolean) to learn more.
474+
Visit the p5.js reference page for [`if`](/reference/p5/if) and [`Boolean`](/reference/p5/Boolean) to learn more.
475475

476476

477477
#### Step Four: Add grass to hide the sun  

src/content/tutorials/en/repeating-with-loops.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ In this tutorial, you will:
3636

3737
- Draw and update repetitive tasks and shapes using *for loops*
3838
- Use custom functions to update variables and program states and make changes in the program as the sketch runs.
39-
- Use [conditional statements](/reference/p5/if-else) and `random()` to generate different outcomes
40-
- Run and stop your sketch using mouse triggers and [Boolean variables](/reference/p5/boolean)
39+
- Use [conditional statements](/reference/p5/if) and `random()` to generate different outcomes
40+
- Run and stop your sketch using mouse triggers and [Boolean variables](/reference/p5/Boolean)
4141
- Store the positions of the caterpillars in an array
4242

4343
### What you’ll need
@@ -162,7 +162,7 @@ function draw() {
162162
}
163163
`} />
164164

165-
### [If-statements](/reference/p5/if-else)
165+
### [If-statements](/reference/p5/if)
166166

167167
If-statements, like the one applied above, refer to blocks of code that are executed only when a given condition is true. It is normally written:
168168

@@ -174,7 +174,7 @@ if (<condition>) {
174174

175175
The condition is specified inside the parentheses of the if-statement. The curly brackets `{ }` mark the start and end of the block of code. In Step 2, the condition `circX > finishLine` stops `draw()` from running again when the x-coordinate of the circle is greater than the value of `finishLine` by calling `noLoop()`.
176176

177-
Visit the p5.js reference for [if](/reference/p5/if-else) to learn more.
177+
Visit the p5.js reference for [if](/reference/p5/if) to learn more.
178178

179179

180180
## Step 3 – Draw one caterpillar

src/content/tutorials/en/responding-to-inputs.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ function checkSelf() {
381381
- It sets the initial direction to the right  with `snake.xSpeed = 1` and `snake.ySpeed = 0`
382382
- It creates an empty array to manage the snake’s body, creates a head segment with the current position, and adds it to the body array.
383383

384-
The `checkEdges()` function uses [if-statements](/reference/p5/if-else) to check if the snake has reached the right edge (`cols`), if the snake has reached the left edge (`-1`), if the snake has reached the top edge (`-1`), and if the snake has reached the bottom edge (`rows`). Whenever any of the conditions are met, it sets `gameOver` to `true`. This creates the rule in the game where if the snake reaches any edge, the game is over. The `moveSnake()` function updates the snake’s position based on its current speed. It updates the x and y positions by adding its `xSpeed` and `ySpeed`, respectively. Refer to the [Conditions and Interactivity](/tutorials/conditionals-and-interactivity/) tutorial to review the syntax for if-statements and updating variables.
384+
The `checkEdges()` function uses [if-statements](/reference/p5/if) to check if the snake has reached the right edge (`cols`), if the snake has reached the left edge (`-1`), if the snake has reached the top edge (`-1`), and if the snake has reached the bottom edge (`rows`). Whenever any of the conditions are met, it sets `gameOver` to `true`. This creates the rule in the game where if the snake reaches any edge, the game is over. The `moveSnake()` function updates the snake’s position based on its current speed. It updates the x and y positions by adding its `xSpeed` and `ySpeed`, respectively. Refer to the [Conditions and Interactivity](/tutorials/conditionals-and-interactivity/) tutorial to review the syntax for if-statements and updating variables.
385385

386386
- The `updateBody()` function updates the positions of the snake’s body segments. It does this by iterating through the snake `body` array starting from the end, updating each body segment’s position to match the position of the segment in front of it. Then it updates the head’s position to the snake’s current position. Refer to the [Repeating with Loops](/tutorials/repeating-with-loops) tutorial to review the syntax for loops and iteration.
387387
- The `drawSnake()` function renders the snake on the canvas. It sets the color to green, iterates through each body segment, and draws a square on the canvas at its position.

0 commit comments

Comments
 (0)