Getting into Scala from a C# background is, from a language point of view, much easier than from a Java background. This talk explores the features that support that conjecture.
Person("luke", List("ios", "drinking redbull")) ) val coolPeople = for { attendee <- attendees if attendee.name.startsWith(“j"); skills <- attendee.skills if skills.contains("scala") } yield attendee.name for yield
=> "One" case 2 => "Two" case n if n > 100 => "More than one hundred" case _ => "Between two and one hundred" } } match case 1 => "One" case n if n > 100 => "More than one hundred" case _ => "Between two and one hundred"
name: String, admin: Boolean) extends Role ! def isAdmin(user: Role) = { user match { case Anon() => println("anons aren't admins”); false case User(name, true) => println(name + " is admin”); true case User(name, false) => println(name + " is not an admin”); false } }
Any*): PreparedStatement = { SQLEngine.prepare(sc.s(args)) } } ! val id = 1 ! val query = sql"select * from users where id = $id" implicit StringContext sql sql"select * from users where id = $id"