Skip to content

Commit

Permalink
fix: fix syntax error in tutorials/organizing-code-with-functions
Browse files Browse the repository at this point in the history
  • Loading branch information
shibomb committed Sep 23, 2024
1 parent 4b7e161 commit 7698eed
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/content/tutorials/en/organizing-code-with-functions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ It is helpful to think of this function like a cookie cutter. For example, you c
  fill(20,130,5);
  triangle(x-size*3,y,x,y-size*8,x+size*3,y)
}
```
```
- Draw two trees in your `draw()` function using arguments.
Expand Down Expand Up @@ -549,7 +549,7 @@ Here is an [example](https://editor.p5js.org/Msqcoding/sketches/l4Mq4a4HG).

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:

[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)
![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)

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.

Expand Down

0 comments on commit 7698eed

Please sign in to comment.