chop removes trailing character or line terminator (\n, \r, or \r\n)
s = "hello\n"
s.chop! # => "hello": line terminator removed. s modified.
s.chop # => "hell": last character removed. s not modified.
"".chop # => "": no characters to remove
"".chop! # => nil: nothing changed
Related examples in the same category