Skip to content

Commit fb8f85a

Browse files
committed
Multiple functions that return value
1 parent 019fbf0 commit fb8f85a

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
add()
3+
{
4+
return $(($1+$2))
5+
}
6+
multiply()
7+
{
8+
return $(($1*$2))
9+
}
10+
# Call Addition for 3 and 4 == 7
11+
add 3 4
12+
# Call multiplication for 3 and 4 == 12
13+
multiply 3 4
14+
# Call Addition for 5 and 4 == 9
15+
add 5 4
16+
# Store answer (always stores final function call returned value)
17+
ans=$?
18+
echo "$ans"
19+

0 commit comments

Comments
 (0)