Getting Started with Scala: Your First Snippet

A friendly Scala intro for developers who just want to write their first few lines of code.

Scala might look intimidating at first, but let’s change that — one clean snippet at a time.


👋 Why Scala?

Scala combines the power of object-oriented and functional programming in one language. It runs on the JVM, making it a great fit for scalable, high-performance apps — but more importantly, you can just start small.


🛠️ Let’s Get Started — A Simple Hello World

Here’s how you write your first Scala program:

object HelloWorld {
  def main(args: Array[String]): Unit = {
    println("Hello, Scala!")
  }
}

🧠 What’s Happening?

  • object is a singleton — like a class with only one instance.
  • main is the entry point (just like in Java).
  • println(...) prints to the console.

✅ To run this:

  • Use the Scala REPL (via terminal or sbt console)
  • Or paste it into Scastie: https://scastie.scala-lang.org and press ▶️ Run. That’s it!

🔍 What’s Next?

Now that you’ve seen how easy it is to run Scala, here’s what you can do next:

👉 [Install Scala in IntelliJ IDEA] – set up a real development environment (Still in progress..)

0
Subscribe to my newsletter

Read articles from Saiprasad Vyawahare directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Saiprasad Vyawahare
Saiprasad Vyawahare