Shallow and deep copy

Hi there
Just a simple question

s1 = "abcd"
s2 = s1.dup
s3 = s1

= and dup both create deep copy of the string?

Thx

Strings are immutable by default, that’s why String#dup returns self.

When you modify a string, a new one is created, the original is never modified (except when messing with unsafe code).

Ok, so is there no difference between second and third line?

thx again

Strings are immutable, there’s no way to modify them.

Ok, so is there no difference between second and third line?

No