Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
suppose set A=1+1;
$A=? The value of A is?
$(A)=? the value of A is?
suppose In one particular expression i am using Variable "A". In that place of Variable "A" suppose i am using the statement "1+1" so what is the output of particular expression?
set evaluates the expression and assigns it to the variable.
set a=1+1;
let b=1+1;
a will have a value of 2, and b will have a value of 1+1.
$ is actually to expand the variable. When you use a variable in the front end, you need to expand the variable using a dollar sign.
say for example a has a value of 1+1, if you simply use a, you will get 1+1 (equivalent of let)
if you expand say $(a) you will get 2 (equivalent of set)
Hope that helps
Hi Rajkumar,
In ur explaination if u are using expression let b=1+1 then 'b' will never have value 1+1 since 'let' always evaluates irrespective of whether the $ is used or not.
Hii Subbu,
set a=1+1;
let b=1+1;
-'a' will have the value 1+1 till you dont use $ before it in frontend, whereas 'b' will have the value 2 irrespective of the $ .
-In short, 'set' keyword considers the value on right side as a string and assigns it to variable 'a' (the expression is evaluated only on applying $ before 'a' in front end) whereas, 'let' evaluates the expression on right side and assigns it to the variable on the left side.
-And for your question $A=?, it is the wrong syntax. $(A) is correct syntax.