Skip to content

Commit

Permalink
Merge pull request #618 from swcarpentry/fun-terminology-diagram
Browse files Browse the repository at this point in the history
Add function terminology diagram and attribution.
  • Loading branch information
isaac-jennings authored Apr 10, 2024
2 parents 9c2c1e2 + 396e796 commit 22a4341
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
2 changes: 2 additions & 0 deletions episodes/02-func-R.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ The list of argument names are contained within parentheses.
Next, the [body](../learners/reference.md#function-body) of the function--the statements that are executed when it runs--is contained within curly braces (`{}`).
The statements in the body are indented by two spaces, which makes the code easier to read but does not affect how the code operates.

![Vocabulary associated with functions.](fig/function-terminology.svg){alt="A screenshot of the function `fahrenheit_to_celsius` defined above with some extra text annotations on specific function elements. Above the text `fahrenheit_to_celsisus`, the text reads 'Function name'. Above the text `temp_F`, the text reads 'Function argument(s)'.' The next two lines, surrounded by curly braces, are labelled 'Function body'."}

When we call the function, the values we pass to it are assigned to those variables so that we can use them inside the function.
Inside the function, we use a [return statement](../learners/reference.md#return-statement) to send a result back to whoever asked for it.

Expand Down
57 changes: 57 additions & 0 deletions episodes/fig/function-terminology.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 22a4341

Please sign in to comment.