Let statement

I came across the following program:

if test $# = 3
then
	case $2 in
	 +) let z=$1+$3;;
	 -) let z=$1-$3;;
	 /) let z=$1/$3;;
	 x|X) let z=$1*$3;;
	 *) echo Warning - $2 invalied operator, only +,-,x,/ operator allowed
	    exit;;
	esac
	echo Answer is $z

What is the usage of let statement? I have never come across the same. Please let me know the usage, syntax and the need.

Instead of using the let statement above, we could have directly used

case $2 in
	 +)  z=$1+$3;;
	 -)  z=$1-$3;;
	 /)  z=$1/$3;;
	 x|X)  z=$1*$3;;

Then what is the need of using "let" here or anywhere else?

let performs arithmetic operations try just :

A=2
B=5
let C1=$A+$B
echo $C1
C2=$A+$B
echo $C2

You see ?

Hi
Thanks, got it.
So, instead of using let and still have the same effect, I can use expr right?

A=2
B=5
C3=`expr $A + $B`
echo $C3

Let command is just simpler since I do not need to use expr command and worry about the backquotes, spaces on either side of + sign and so on so forth

Right?
Thanks again

The let command is unnecessary and is not standard.

There is no need for expr in a modern (i.e., POSIX) shell. Use the shell's own arithmetic capabilities:

C3=$(( $A + $B ))