Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
what is the difference b/w set and let?
What is the use of that? And when we are using please tel me.....
Hi Rajashekar,
Please find Below:
:SET :
The SET statement is used when you want a variable to hold the string or numeric value that is to the right of the Equal (=) sign.
When used, the variable is substituted by its value.
Set variable = string
Eg : Set Myvar=2*3 returns “ 2*3”
LET :
The let statement, in opposition to the set statement, evaluates the expression on the right side of the ' =' before it is assigned to the macro variable.
Let variable = Expression
Eg : Let MyVar =2*3 returns “6”
Hope it helps..
Thanks,
Arvind Patil
Thank you so much...............
In simple words; let performs the calculation while set does not
Exp:
Set 3+2 => 3+2
Let 3+2 => 5
Hi Rajashekar,
The below explanation may help you.
Let:-
The let statement is a complement to the set statement, used for defining script variables. The let statement, in opposition to the set statement, evaluates the expression on the right side of the ' =' before it is assigned to the variable.
Syntax:-Let variablename=expression
Set:-
The set statement is used for defining script variables. These can be used for substituting strings, paths, drives, and so on.
Syntax:- Set variablename=string
Use SET if you want to assign a static value to a variable
e.g. SET Dept = 'Accounts';
Use LET if you want to assign a value resulting from expression (Dynamically)
e.g. LET Dept = Peek('DepartmentName',0,'MyDept');
Regards!
Rahul Pawar