In this lesson, we’ll continue working with variables and take a deeper dive into the data types Strings and Characters.

illustration of a String

Recall that a String in Kotlin is a sequence of characters wrapped in double-quotes. Its characters can include various combinations of digits, letters, symbols, and whitespace.

var variableName: String = "some text"  

Strings are made up of characters and in Kotlin, a character is a data type representing a single letter, digit, or symbol wrapped in single quotes. It is denoted by the Char type.

var variableName: Char = 'A' 

Some things to keep in mind about characters:

  • The character, 'A', is not the same as 'a' as these letters represent different Unicodes and won’t be recognized as equivalent by the compiler.

  • The character, '1', is not the same as the integer, 1, as these values signify two different types of data: Char and Int.

Reference Kotlin’s documentation to learn more about Strings and Characters.


Take a look at the code editor on the right and observe some of the shorthand variable declarations for String and Char values.

Click Next when you’re ready to move on.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?