Skip to content

Instantly share code, notes, and snippets.

@dacr
Last active February 3, 2026 20:23
Show Gist options
  • Select an option

  • Save dacr/81dc9cea631bfb48626180dd4734d902 to your computer and use it in GitHub Desktop.

Select an option

Save dacr/81dc9cea631bfb48626180dd4734d902 to your computer and use it in GitHub Desktop.
scala3 feature examples - indentations / published by https://github.com/dacr/code-examples-manager #d3322b8d-b69c-447f-ab45-abd637e47978/3a56fd4359d8d01946d39822857220ff48f33f04
// summary : scala3 feature examples - indentations
// keywords : scala3, tutorial, @testable
// publish : gist
// authors : David Crosson
// license : Apache License Version 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt)
// id : d3322b8d-b69c-447f-ab45-abd637e47978
// created-on : 2021-04-20T09:43:13+02:00
// managed-by : https://github.com/dacr/code-examples-manager
// run-with : scala-cli $file
//> using scala "3.4.2"
def hello(name:String) =
s"Hello $name"
case class Something(message:String):
def add(x:Int,y:Int):Int =
x+y
def hi(nameOption:Option[String]):Unit =
nameOption match
case None => println("Hi world")
case Some(name) => println(s"Hi $name")
case class Blah(needed:Boolean):
override def toString: String = "BlahBlah"
def truc(blah:Blah):String =
if blah.needed then blah.toString
else "bouhh"
@main def go():Unit =
println(hello("John Doe"))
println(Something("blah").add(40,2))
hi(Some("joe"))
println(truc(Blah(true)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment