Tech and Media Labs
This site uses cookies to improve the user experience.

Scala Data Types

Jakob Jenkov
Last update: 2014-05-25

Scala comes with the following built-in data types which you can use for your Scala variables:

Type Value Space
Boolean    true or false
Byte 8 bit signed value
Short 16 bit signed value
Char 16 bit unsigned Unicode character
Int 32 bit signed value
Long 64 bit signed value
Float 32 bit IEEE 754 single-precision float
Double 64 bit IEEE 754 double-precision float
String A sequence of characters

Here is an example of how to declare a variable to be of a certain type:

var myInt : Int

var myString : String

All Data Types are Objects

All the data types listed above are objects. There are no primitive types like in Java. This means that you can call methods on an Int, Long etc. if you want to.

Jakob Jenkov

Copyright  Jenkov Aps
Close TOC