From my understanding => used to bound string as a variable name.
For ex,
df1 = DataFrame(x=1:2, y= 11: 12)
df2 = DataFrame("x"=>1:2, "y"=> 11: 12)
Both returns same result,
│ Row │ x │ y │
│ │ Int64 │ Int64 │
├─────┼───────┼───────┤
│ 1 │ 1 │ 11 │
│ 2 │ 2 │ 12 │
Here the only difference is in df1's x variable holds 1:2 whereas in df2's "x" string holds 1:2. So, from the above result, I presumed to create variable from string I can use =>.
But when I tried holding values in simple variable like below
x = 10
O/P: 10
"y"=>10
O/P: "y" => 10
This result I couldn't understand. When I print x it has 10 as expected. But when I print y I am getting UndefVarError. I found the same effect with Symbol also :z =>10
My assumption about => is wrong I guess. Because string is actually not converted as a new variable.
What is the actual purpose of => in julia?
In which I have to use => rather than =?