Advertisement
Guest User

Untitled

a guest
Jun 20th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.37 KB | None | 0 0
  1.   def test_the_shovel_operator_modifies_the_original_string
  2.     original_string = "Hello, "
  3.     hi = original_string
  4.     there = "World"
  5.     hi << there
  6.     assert_equal "Hello, World", original_string
  7.  
  8.     # THINK ABOUT IT:
  9.     #
  10.     # Ruby programmers tend to favor the shovel operator (<<) over the
  11.     # plus equals operator (+=) when building up strings.  Why?
  12.   end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement