DrSchool Learn coding, fast.
EN AR BN CS DE EL Search

Functions — Example 87

Quick explanation + ready code for: Functions.

Shell Functions Back to examples
Back to language
Syntax: Functions in Shell. ID: #87

Code

add(){ echo $(($1+$2)); }
add 12 15

Notes

You can copy this snippet and adapt it. For advanced, add real-world inputs, edge cases, and tests.