M
M
Meridian3122013-12-20 15:15:21
ruby
Meridian312, 2013-12-20 15:15:21

What do notation literals or symbols mean in Ruby?

Why and how they work, practical application?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
progenth, 2013-12-20
@Meridian312

If you are talking about this,
then these are not mutable lines. They are lighter and more comfortable in some places.
for example

"string"
"string"
"string"

they are different objects, although they are exactly the same, and
:string
:string
:string

it's the same object.
Accordingly, there is 1 object in memory, not 3. If we assume that we use characters as keys somewhere in the array, then the gain is obvious.
As for convenience, here of course the taste and color.
Many people
like it more than
A in rails in general all the time ...

O
OnYourLips, 2013-12-20
@OnYourLips

In a nutshell: immutable strings, memory is allocated once and not released.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question