Bird
0
0

Identify the error in this Kotlin script file example.kts:

medium📝 Debug Q14 of 15
Kotlin - Basics and JVM Runtime
Identify the error in this Kotlin script file example.kts:
val name = "Alice"
println(Name)
AScript files cannot use println
BVariable 'Name' is not defined (case sensitive)
CMissing semicolon after println statement
DString literals must use single quotes
Step-by-Step Solution
Solution:
  1. Step 1: Check variable usage

    Variable declared as 'name' but used as 'Name' which differs in case.
  2. Step 2: Understand Kotlin case sensitivity

    Kotlin variables are case sensitive, so 'Name' is undefined causing error.
  3. Final Answer:

    Variable 'Name' is not defined (case sensitive) -> Option B
  4. Quick Check:

    Variable names are case sensitive [OK]
Quick Trick: Check variable name case carefully [OK]
Common Mistakes:
MISTAKES
  • Thinking semicolons are mandatory
  • Believing println is disallowed in scripts
  • Using single quotes for strings in Kotlin

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kotlin Quizzes