Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Conversion

case class

case class Person(name: String)
  def greet(): String = s"Hello, $name"
given fromStringToPerson: Conversion[String, Person] = Person(_)
@main def run =
  println("John".greet())

Scope

The conversion rules are the same as the given rules

  1. imported conversion
  2. current scope
  3. companion object