Skip to content

Instantly share code, notes, and snippets.

@dacr
Last active May 6, 2023 15:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dacr/af07102693781259b9403028ea4afab1 to your computer and use it in GitHub Desktop.
Save dacr/af07102693781259b9403028ea4afab1 to your computer and use it in GitHub Desktop.
ZIO learning - hello world with for comprehension and zio app / published by https://github.com/dacr/code-examples-manager #4bd9249e-4736-4755-a2ef-a35f4ee427a5/b5c74ef9ad7f8b5cb6c652bc86379751124c3d8e
// summary : ZIO learning - hello world with for comprehension and zio app
// keywords : scala, zio, learning, pure-functional, helloworld
// publish : gist
// authors : David Crosson
// license : Apache NON-AI License Version 2.0 (https://raw.githubusercontent.com/non-ai-licenses/non-ai-licenses/main/NON-AI-APACHE2)
// id : 4bd9249e-4736-4755-a2ef-a35f4ee427a5
// created-on : 2021-06-05T21:53:50+02:00
// managed-by : https://github.com/dacr/code-examples-manager
// run-with : scala-cli $file
// ---------------------
//> using scala "3.2.2"
//> using dep "dev.zio::zio:2.0.13"
// ---------------------
// ------------------------------------------------------------------------------
// Inspired from Example coming from https://zio.dev/docs/getting_started.html
import zio.*
object HelloWorld extends ZIOAppDefault {
val appLogic = for {
_ <- Console.printLine("Hello! What is your name?")
name <- Console.readLine
_ <- Console.printLine(s"Hello, $name, welcome to ZIO!")
} yield ()
def run = appLogic
}
HelloWorld.main(Array.empty)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment