Basics Flashcards
They perform operations on numbers, strings, and other values
literals
(5) basic literals
integers, characters, strings, boolean, and arrays
numbers
integer or int
A single character can represent a digit, a letter, or another symbol
character or char
To write a single character, we wrap in
single quotes
NOTE: Character literals can represent alphabet letters, digits from ‘0’ to ‘9’, whitespaces (‘ ‘), or some other symbols
incorrect: ‘abc’, ‘543’
text information
string
To write strings, we wrap characters in
double quotes
NOTE: “text”, “I want to learn Kotlin”, “123456”, “e-mail@gmail.com”
A string can also contain just one single character, like “A”. Do not confuse it with the character ‘A’, which is not a string.
(6) relational operators
== — equal to X
!= — not equal to X
> — greater than X
> = — greater than or equal to X
< — less than X
<= — less than or equal to X
NOTE: Boolean value (true or false)
a way of writing numbers using only two digits, 0 and 1
binary numeral system or base-2 numeral system
when a digit reaches 1, the next number resets this digit to 0 and causes the digit to the left to raise
binary counting
work with binary numbers of a fixed length
zero padding
NOTE:
- triads: 000, 001, 010, and so on;
- tetrads: 0110, 0111, and so on;
- 8-digit numbers: 00000000, 01010101, and so on.
An 8-digit binary number
NOTE: 256 possible values from 0 to 255
byte
a way of storing information
binary code
each character in the text string represented by a 7-digit binary number
ASCII code
(American Standard Code for Information Interchange)
Red, Green, Blue
NOTE: color encoding system stores 3 binary values
RGB