Copy a string: Difference between revisions

Content deleted Content added
Line 260: Line 260:
assert string == stringCopy // they have equal values
assert string == stringCopy // they have equal values
assert ! string.is(stringCopy) // they are references to different objects (like Java !=)</lang>
assert ! string.is(stringCopy) // they are references to different objects (like Java !=)</lang>

'''Caveat Lector''': Strings are immutable objects in Groovy, so it is wasteful and utterly unnecessary to ever make copies of them within a Groovy program.


=={{header|Haskell}}==
=={{header|Haskell}}==