Function definition: Difference between revisions

m
→‎{{header|UNIX Shell}}: Quote parameters to prevent word-splitting.
(Add ColdFusion)
m (→‎{{header|UNIX Shell}}: Quote parameters to prevent word-splitting.)
Line 1,115:
Note that in the Unix shell, function definitions do not include any argument specifications within the parentheses. Instead arguments to functions are obtained using the positional parameters.
 
{{works with|Bourne Shell}}
<lang shbash>multiply() {
# There is never anything between the parentheses after the function name
# Arguments are obtained using the positional parameters $1, and $2
# The return is given as a parameter to the return command
return `expr "$1" \* "$2"` # The backslash is required to suppress interpolation
}
 
Anonymous user