Skip to content

Update micropython-basics.md #1908

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ Then with the `while` loop we execute the statements as long as the condition is

## Functions

A function is a block of code, a sequence of instructions composed by several statements, which runs only when it is called.
A function is a block of code, a sequence of instructions comprising several statements, that runs only when it is called.
You can pass the information as parameters into a function. A function can have input arguments, and can also have output parameters.

We can define our own functions, the most common way can be specified using the def keyword, inside the parentheses you can find the arguments if there are. Take a look to the example below:
We can define our own functions. The most common way involves using the def keyword, inside the parentheses you can find the arguments if there are any. Consider the follpowing example:

```python
def my_function():
Expand All @@ -73,7 +73,7 @@ Then you can call your function using the function name followed by parentheses:
my_function()
```

The function need two components: the header, starting with keyword def, followed by parentheses with inside the arguments and ending by colon (:) and the indented body is composed by descriptive string, function statements, return statements.
The function needs two components: the header, starting with keyword def, followed by parentheses with inside the arguments and ending by colon (:) and the indented body is composed by descriptive string, function statements, return statements.

This script prints "Hello world!" every second. In addition, the function counter_function() increases the number every second and will be printed next to.

Expand Down Expand Up @@ -155,4 +155,4 @@ def printFruitNames():
print(fruit)

printFruitNames()
```
```