class String

def first(limit = 1)

str.first(6) # => "hello"
str.first(0) # => ""
str.first(2) # => "he"
str.first(1) # => "h"
str.first # => "h"
str = "hello"

given limit is greater than or equal to the string length, returns a copy of self.
from the beginning of the string until it reaches the limit value. If the
Returns the first character. If a limit is supplied, returns a substring
def first(limit = 1)
  self[0, limit] || raise(ArgumentError, "negative limit")
end