#a function prints its value with echo,
#and $( ) takes the printed text into a variable
getSum() {
local n1=$1
local n2=$2
echo $((n1 + n2))
}
sum=$(getSum 5 3)
#sum is 8
#return sets only the exit code, a number from 0 to 255,
#so it does not carry a value: 300 turns into 44
getCode() {
return $(($1 + $2))
}
getCode 200 100
code=$?
#code is 44
echo "sum is $sum"
echo "code is $code"