Scala Keywords

Review Scala keywords and language features. Browse links on these keywords.

Keywords. In 2004 Java was an established language. Scala emerged at this time. Scala (a scalable language) may solve some of Java's failures.

Keyword list. In this language, a variable or constant uses var or val. A loop begins with for or while. A selection uses match or if.casecatchclassdefdoelseextendsfalsefinalforifmatchnewnullprintprintfprintlnthrowtotraittruetryuntilvalvarwhilewith

Predefined types. In Scala we can define our own custom types. But more often, we use predefined types like List and Int and String. These types are powerful and full-featured.ArrayBooleanConsoleDoubleIntListMapNoneOptionOrderingRangeRegexSetStdInStringStringBuilderThrowableVector

Syntax. Some languages end up looking like random characters in a text file. Scala has some syntax noise, but it is fairly clear to read and understand.:+ (Add to end of vector)+ (Add to map):: (Add to start of list)+: (Add to start of vector)++ (Combine two lists)<- (Enumerate loop)_1 (Get tuple item 1)& (Intersect set)=> (Lambda)-> (Map argument)"""a""" (Multi-line string literal)_ (Placeholder argument syntax)String* (Repeated argument)List[String] (Type parameter)

To start developing Scala programs, please visit the official site. Downloads are available to compile Scala code. This is similar to Java and many of the same methods are used.Scala: scala-lang.org

Specification. A spec is critical to the understanding (and standardization) of a language. Scala has a complete spec but it is not easy reading. Some review is helpful.Specification: scala-lang.org

A review. Scala is a language that promotes fast development of programs. There is less syntax. We build methods on single lines. These keywords determine the meaning of our programs.

© 2007-2020 Sam Allen. Every person is special and unique. Send bug reports to info@dotnetperls.com.