Skip to content

Commit 431c022

Browse files
authored
Add comments to functions (bobbyiliev#26)
1 parent da760f9 commit 431c022

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

ebook/en/content/012-bash-functions.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,23 @@ function hello(){
4444
hello DevDojo
4545
```
4646

47-
In the next few chapters we will be using functions a lot!
47+
Functions should have comments mentioning description, global variables, arguments, outputs, and returned values, if applicable
48+
49+
```bash
50+
#######################################
51+
# Description: Hello function
52+
# Globals:
53+
# None
54+
# Arguments:
55+
# Single input argument
56+
# Outputs:
57+
# Value of input argument
58+
# Returns:
59+
# 0 if successful, non-zero on error.
60+
#######################################
61+
function hello(){
62+
echo "Hello $1!"
63+
}
64+
```
65+
66+
In the next few chapters we will be using functions a lot!

0 commit comments

Comments
 (0)