1-7 Kotlin Basic Concepts - Char, Boolean, String

Publié le: 29 août 2025
sur la chaîne: Ace The Code
17
1

KOTLIN BASIC CONCEPTS - Char, String & Boolean Types

► BOOLEANS

1. The type Boolean represents boolean objects that can have
two values: true or false
2. Logical OR i.e. ||, logical AND i.e. && and logical not
i.e. ! Operators can be used on boolean type variables.
3. Kotlin also supports SHORT CIRCUIT BOOLEAN expressions

► CHARACTER TYPE

1. Characters are represented using Char data type.
2. Character literals go inside single quotes e.g. val grade = ‘A’
3. Koltin also uses UNICODE character specification.
ESCAPE SEQUENCES

1. \t – tab
2. \b – backspace
3. \n – new line
4. \r – carriage return
5. \’ – single quote
6. \” – double quote
7. \\ - backlash
8. \$ - dollar sign

► STRING TYPE

1. Strings in Kotlin are represented using String data type
2. Strings are immutable. Once you initialize the a string, you
can’t change it’s value or assign new value.
3. All operations which transforms strings returns new String
object leaving original string unchanged.
ACCESSING STRING CHAR BY CHAR

1. String can be accessed char by char via the indexing operation
i.e. you can treat string as array of chars and can access i th
index element of string using indexing operation e.g. str[ i ]
2. + operator can be used for string concatenation.

► MULTILINE STRINGS

1. Multiline strings can contain newlines and arbitrary text.
2. It is delimited by a triple quote i.e. “““
3. This type of string does not require escape sequence for
special characters except $ symbol
4. Example: val str: String = “““Kotlin language is Google’s
Choice for Android App Development”””

► STRING TEMPLATES

1. String literals may contain template expressions i.e. pieces of
the code that are evaluated and whose results are
concatenated into a string.
2. A template expression starts with a dollar sign and consists or
either variable name or an expression in curly braces.

#kotlin
#kotlintutorials
#android
#kotlinbasics


Sur cette page du site, vous pouvez voir la vidéo en ligne 1-7 Kotlin Basic Concepts - Char, Boolean, String durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Ace The Code 29 août 2025, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 17 fois et il a aimé 1 téléspectateurs. Bon visionnage!