Skip to content

Instantly share code, notes, and snippets.

@dacr
Last active May 25, 2024 10:19
Show Gist options
  • Save dacr/dc60e4fe02e2b4ef85d68cef934e8b6e to your computer and use it in GitHub Desktop.
Save dacr/dc60e4fe02e2b4ef85d68cef934e8b6e to your computer and use it in GitHub Desktop.
ZIO learning - hello world using command line arguments / published by https://github.com/dacr/code-examples-manager #d8733706-94fb-439f-8397-bdef034736ea/fdbf58c662e631653b22cc6ff737fae17fd16215
// summary : ZIO learning - hello world using command line arguments
// 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 : d8733706-94fb-439f-8397-bdef034736ea
// created-on : 2022-02-27T09:58:19.926769334Z
// managed-by : https://github.com/dacr/code-examples-manager
// run-with : scala-cli $file
// usage-example : scala-cli zio-learning-1-hello-5.sc -- john doe
// ---------------------
//> using scala "3.4.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 {
args <- getArgs
_ <- Console.printLine(s"Hello, ${args.mkString(" ")}, welcome to ZIO!")
} yield ()
def run = appLogic
}
HelloWorld.main(args)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment