Skip to content

Commit d6a9b2e

Browse files
authored
Merge pull request #570 from shibomb/fix/fix-tutorials-organizing-code-with-functions
fix syntax errors in tutorials/organizing-code-with-functions
2 parents cba5370 + 7698eed commit d6a9b2e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/content/tutorials/en/organizing-code-with-functions.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ It is helpful to think of this function like a cookie cutter. For example, you c
403403
  fill(20,130,5);
404404
  triangle(x-size*3,y,x,y-size*8,x+size*3,y)
405405
}
406-
```
406+
```
407407

408408
- Draw two trees in your `draw()` function using arguments.
409409

@@ -549,7 +549,7 @@ Here is an [example](https://editor.p5js.org/Msqcoding/sketches/l4Mq4a4HG).
549549

550550
Functions such as `random()` produce, or **return**, values that can be used elsewhere in your code. Here’s an example of a function that adds 5 to its parameter and returns the result:
551551

552-
[The syntax for function declaration that returns the value “ans” with labeled arrows pointing to its various parts. An arrow labeled “keyword ‘function’” points to the word “function”;  an arrow labeled “function name” points to “plus5”; an arrow labeled “parameter” points to the letter “n” within parentheses; the body of the function is labeled “block of code in curly braces” with the code “let ans = n + 5” and “return ans;” on separate lines.](../images/introduction/function-return.jpg)
552+
![The syntax for function declaration that returns the value “ans” with labeled arrows pointing to its various parts. An arrow labeled “keyword ‘function’” points to the word “function”;  an arrow labeled “function name” points to “plus5”; an arrow labeled “parameter” points to the letter “n” within parentheses; the body of the function is labeled “block of code in curly braces” with the code “let ans = n + 5” and “return ans;” on separate lines.](../images/introduction/function-return.jpg)
553553

554554
Similar to other function declarations, the keyword `function` is followed by the function name and a pair of parentheses. This function has one parameter, `n` within the parenthesis. The body of the function includes a numerical expression and **return statement**. The keyword `return` tells functions to finish executing the code block and provide a result as an output value.
555555

0 commit comments

Comments
 (0)