Data Types & Variables
Learn about variables and the various data types that are supported in Kotlin.
StartKey Concepts
Review core concepts you need to learn to master this subject
Mutable Variables
Immutable Variables
Type Inference
String Concatenation
String Templates
Built-in Properties and Functions
Character Escape Sequences
Arithmetic Operators
Mutable Variables
Mutable Variables
var age = 25
age = 26
A mutable variable is declared with the var
keyword and represents a value that is expected to change throughout a program.
Data Types & Variables
Lesson 1 of 3
- 1In this lesson, we’ll explore the building blocks of a programming language - data types and variables. A data type represents the type of value an object possesses. Here are a few of the types o…
- 2Now that we’ve familiarized ourselves with the concept of variables, let’s learn how to create a variable in Kotlin. A complete variable declaration and initialization resembles the following form:…
- 3Another type of variable that exists in Kotlin is the immutable variable. The term, immutable, signifies a variable whose value cannot mutate or change after its initialization. _Immutable variab…
- 4In Kotlin, we can save keystrokes and optimize our variable declarations with a feature known as type inference. Type inference indicates that the compiler can infer the type of a declared vari…
What you'll create
Portfolio projects that showcase your new skills
How you'll master it
Stress-test your knowledge with quizzes that help commit syntax to memory