Strings In Depth19 / 19
Up next

Extension methods

// an extension method adds a method to an existing type
extension (s: String)
  def shout: String = s.toUpperCase + "!"

@main def main(): Unit =
  println("hello".shout)
What you're solving

add new syntax to String