From d13948f296561d422ffb4515f2667824a2431196 Mon Sep 17 00:00:00 2001 From: gkepka Date: Mon, 9 Dec 2024 12:45:01 +0100 Subject: [PATCH] Scala 2 Book migration - Prelude and Preliminaries --- _overviews/scala3-book/introduction.md | 6 ++--- _overviews/scala3-book/taste-intro.md | 36 ++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/_overviews/scala3-book/introduction.md b/_overviews/scala3-book/introduction.md index c1dd65583..b3798aeab 100644 --- a/_overviews/scala3-book/introduction.md +++ b/_overviews/scala3-book/introduction.md @@ -25,9 +25,9 @@ Scala’s syntax, grammar, and features have been re-thought, debated in an open The book begins with a whirlwind tour of many of Scala’s features in the [“A Taste of Scala” section][taste]. After that tour, the sections that follow it provide more details on those language features. -{% comment %} -We should have a link structure on the whole tour here -{% endcomment %} +## A bit of background + +Scala was created by [Martin Odersky](https://en.wikipedia.org/wiki/Martin_Odersky), who studied under [Niklaus Wirth](https://en.wikipedia.org/wiki/Niklaus_Wirth), who created Pascal and several other languages. Mr. Odersky is one of the co-designers of Generic Java, and is also known as the “father” of the `javac` compiler. [reference]: {{ site.scala3ref }}/overview.html [taste]: {% link _overviews/scala3-book/taste-intro.md %} diff --git a/_overviews/scala3-book/taste-intro.md b/_overviews/scala3-book/taste-intro.md index 72f74faee..9d93b317c 100644 --- a/_overviews/scala3-book/taste-intro.md +++ b/_overviews/scala3-book/taste-intro.md @@ -21,6 +21,42 @@ can be installed by following our [getting started guide][get-started]. > Alternatively you can run the examples in a web browser with [Scastie](https://scastie.scala-lang.org), a > fully online editor and code-runner for Scala. +## Comments + +One good thing to know up front is that comments in Scala are just like comments in Java (and many other languages): + +{% tabs comments %} +{% tab 'Scala 2 and 3' for=comments %} +```scala +// a single line comment + +/* + * a multiline comment + */ + +/** + * also a multiline comment + */ +``` +{% endtab %} +{% endtabs %} + +## IDEs + +The two main IDEs (integrated development environments) for Scala are: + +- [IntelliJ IDEA](/getting-started/intellij-track/building-a-scala-project-with-intellij-and-sbt.html) +- [Visual Studio Code](https://scalameta.org/metals/docs/editors/vscode/) + +## Naming conventions + +Another good thing to know is that Scala naming conventions follow the same “camel case” style as Java: + +- Class names: `Person`, `StoreEmployee` +- Variable names: `name`, `firstName` +- Method names: `convertToInt`, `toUpper` + +More on conventions used while writing Scala code can be found in the [Style Guide](/style/index.html). [reference]: {{ site.scala3ref }}/overview.html [get-started]: {% link _overviews/getting-started/install-scala.md %}