Recap - Initialize Variables
Part of the Fundamentals section of Coddy's Kotlin journey. Lesson 11 of 93.
Challenge
BeginnerWrite code that initializes the following values:
kwith the value88(note: lowercase 'k')PIwith the value3.14(note: uppercase 'PI')namewith the value"Bob"
Make sure you use the exact variable names and values. Remember:
- Kotlin is case sensitive! (
k≠K)- String values must be enclosed in double quotes:
"Bob"notBob- Use
valto declare read-only values- Put your statements inside the provided
fun main() { }
Try it yourself
fun main() {
// Type your code below
// Don't change the lines below
println("k = $k")
println("PI = $PI")
println("name = $name")
}All lessons in Fundamentals
4Operators Part 1
Arithmetic OperatorsModulo OperatorAugmented AssignmentComparison OperatorsRecap - Simple Math7Basic IO
Println FunctionString TemplatesReadLine InputType ConversionRecap - Years Until RetirementRecap - True or False10Functions
Declare A FunctionParameters And ArgumentsReturn ValuesNamed ArgumentsDefault ValuesSingle Expression FunctionsRecap - Sigma FunctionRecap - Validation Function2Variables
Val vs VarType InferenceNumbersStringBooleanNaming ConventionsRecap - Initialize Variables5Operators Part 2
Logical Operators Part 1Logical Operators Part 2Logical Operators Part 3Ternary With If ExpressionRecap - Simple Logic8Bill Split Calculator
Welcome MessageGetting Input3Nullability
What Is Null SafetyNullable TypesSafe Call OperatorElvis OperatorFunction Challenge BasicsNot Null AssertionRecap - Safe Access6Decision Making
If StatementIf - ElseIf As An ExpressionWhen ExpressionWhen With RangesRecap - Simple Calculator9Loops
For LoopWhile LoopDo-While LoopBreakContinueRanges In LoopsNested LoopRecap - FactorialRecap - Dynamic InputPractice on your own: Kotlin playground