Use the 'var' keyword to define a mutable variable.
Use the 'val' keyword to define an immutable variable.
The default visibility modifier in Kotlin is 'public'.
Use the 'fun' keyword followed by the function name and parentheses.
Yes, specify the return type after the function name and a colon.
Use nullable types by adding a '?' to the type, e.g., 'String?'.
The 'when' expression is used as a replacement for switch statements.
Use 'listOf()' for an immutable list or 'mutableListOf()' for a mutable list.
Use the 'class' keyword followed by the class name.
String templates allow embedding variables or expressions in strings using '\$'.
Extension functions allow you to add new functions to existing classes without modifying their source code.
'==' checks structural equality, while '===' checks referential equality.
Use the 'object' keyword to define a singleton.
A data class is a class primarily used to hold data and automatically provides methods like 'toString()', 'equals()', and 'hashCode()'.
Use 'try', 'catch', and 'finally' blocks to handle exceptions.
The 'lateinit' keyword is used to declare a variable that will be initialized later.
A higher-order function is a function that takes another function as a parameter or returns a function.
'var' is mutable, while 'val' is immutable.
Lambda expressions are anonymous functions defined using curly braces, e.g., '{ x -> x * 2 }'.
The 'by' keyword is used for delegation, such as property delegation or delegation of interface implementation.
A sealed class is used to represent restricted class hierarchies, where a value can only be one of the types defined in the class.
The 'inline' keyword is used to reduce the overhead of higher-order functions by inlining their code.
Coroutines are used for asynchronous programming and can be launched using 'launch' or 'async' builders.
'apply' returns the context object, while 'also' returns the result of the lambda expression.
A companion object is used to define static members for a class.
Inline classes are used to create type-safe wrappers without the runtime overhead of additional objects.
Delegation in Kotlin can be implemented using the 'by' keyword for both property and interface delegation.
The 'suspend' keyword is used to define functions that can be paused and resumed in coroutines.
Flow is a cold asynchronous data stream that emits values sequentially and supports backpressure.
Custom DSLs can be created using Kotlin's extension functions, lambdas with receivers, and infix functions.
'launch' is used for fire-and-forget coroutines, while 'async' is used to return a Deferred result.
Kotlin uses reified type parameters with the 'inline' keyword to retain type information at runtime.
These keywords are used in Kotlin Multiplatform to define platform-specific implementations.
The 'withContext' function is used to switch the coroutine context for a specific block of code.
Coroutine scopes define the lifecycle of coroutines and are tied to a specific context, such as 'GlobalScope' or 'viewModelScope'.
Shared mutable state can be handled using thread-safe constructs like 'Mutex' or 'Atomic' classes.
Sealed interfaces allow defining restricted hierarchies similar to sealed classes but for interfaces.
The 'buildSequence' function is used to create lazy sequences using a coroutine-like builder.
Channels are hot streams for communication between coroutines, while flows are cold streams for data processing.
Use 'Dispatchers.IO' for I/O operations, 'Dispatchers.Default' for CPU-intensive tasks, and 'Dispatchers.Main' for UI updates.
The 'coroutineScope' function creates a new coroutine scope and waits for all child coroutines to complete.
Suspend functions can be paused and resumed, while regular functions cannot.
The 'super' keyword is used to call superclass methods or access superclass properties.
'open' allows a class or method to be overridden, while 'final' prevents it from being overridden.
The 'override' keyword is used to indicate that a method or property is overriding a superclass member.
Abstract classes can have state and implementation, while interfaces can only have abstract methods and properties.
The 'data' keyword is used to define a data class that automatically generates common methods like 'toString()', 'equals()', and 'hashCode()'.
'this' refers to the current instance, while 'super' refers to the superclass instance.
A companion object allows defining static members for a class and can implement interfaces.
'lateinit' is used for non-nullable properties that will be initialized later, while nullable properties can hold null values.