Skip to content

Commit

Permalink
Move function basics to separate file
Browse files Browse the repository at this point in the history
  • Loading branch information
VaclavMacha committed Sep 18, 2024
1 parent f04a87e commit 95f1cd2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
9 changes: 0 additions & 9 deletions docs/src/lecture_02/conditions.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,6 @@ julia> compare(2.3, 2.3)
x is equal to y
```

!!! info "Function declaration:"
So far, we did not show how to define functions. However, the above example should show the basic syntax for defining functions. The `return` keyword specifies the function output. In this case, the function returns nothing since we only want to compare numbers. If we need to define a function that returns more than one variable, the following syntax is used.

```julia
return x, y, z
```

Here `x`, `y`, and `z` are some variables. We will discuss the function declaration in more detail in the [next lesson](@ref Functions).

The `elseif` and `else` keywords are optional. Moreover, it is possible to use as many `elseif` blocks as needed.

```jldoctest conditions
Expand Down
10 changes: 10 additions & 0 deletions docs/src/lecture_02/functions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## Function basics

!!! info "Function declaration:"
So far, we did not show how to define functions. However, the above example should show the basic syntax for defining functions. The `return` keyword specifies the function output. In this case, the function returns nothing since we only want to compare numbers. If we need to define a function that returns more than one variable, the following syntax is used.

```julia
return x, y, z
```

Here `x`, `y`, and `z` are some variables. We will discuss the function declaration in more detail in the [next lesson](@ref Functions).

0 comments on commit 95f1cd2

Please sign in to comment.