Monday, 1 February 2016

Julia: Assignment operator


Assignment operator (=) is used to assign a value to a variable.
julia> a=10;

julia> a
10

julia> name="Hari Krishna";

julia> name
"Hari Krishna"

Julia support compound assignment also.
Compound assignment operator
Example
Description
+=
a+=10
a=a+10
-+
a-=10
a=a-10
*=
A*=10
a=a*10
/=
a/=10
a=a/10
\=
a\=10
a=a\10
^=
a^=10
a=a^10
%=
a%=10
a=a%10
&=
a&=b
a=a&b
|=
a|=b
a=a|b
$=
a$=b
a=a$b
>>>=
a>>>=10
a=a>>>10
>>=
a>>=10
a=a>>10
<<=
a<<=10
a=a<<10


julia> a=10;b=10;c=10;d=10;

julia> a+=10;b-=10;c*=10;d/=10;

julia> a
20

julia> b
0

julia> c
100

julia> d
1.0






Previous                                                 Next                                                 Home

No comments:

Post a Comment