If-else Expression Assignment in Kotlin
📖 Scenario: You are creating a simple program to decide if a person is eligible to vote based on their age.
🎯 Goal: Build a Kotlin program that uses an if-else expression to assign a message about voting eligibility.
📋 What You'll Learn
Create an
age variable with a specific valueCreate a variable
votingMessage that uses an if-else expression to assign the correct messageUse the exact messages:
"Eligible to vote" and "Not eligible to vote"Print the
votingMessage variable💡 Why This Matters
🌍 Real World
Deciding eligibility or status based on conditions is common in apps like voting systems, age verification, or access control.
💼 Career
Understanding if-else expressions is fundamental for writing clear and concise Kotlin code in many software development roles.
Progress0 / 4 steps