Kotlin - FunctionsWhy does Kotlin restrict infix functions to have exactly one parameter and be member or extension functions?ATo keep the syntax simple and readable like natural language expressionsBTo improve runtime performance by limiting parametersCTo enforce strict type safety at compile timeDTo allow infix functions to be used only in top-level declarationsCheck Answer
Step-by-Step SolutionSolution:Step 1: Understand Kotlin design goals for infix functionsKotlin restricts infix functions to one parameter and member/extension functions to keep calls simple and readable.Step 2: Evaluate optionsTo keep the syntax simple and readable like natural language expressions matches this reasoning; others describe unrelated goals.Final Answer:To keep the syntax simple and readable like natural language expressions -> Option AQuick Check:Infix function restrictions = readability and simplicity [OK]Quick Trick: Infix rules exist to keep code clean and readable [OK]Common Mistakes:MISTAKESThinking restrictions improve performanceConfusing with type safety enforcementBelieving infix functions must be top-level
Master "Functions" in Kotlin9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More Kotlin Quizzes Collections Fundamentals - Why immutable collections are default - Quiz 5medium Control Flow as Expressions - When expression as powerful switch - Quiz 11easy Control Flow as Expressions - Smart casts in when and if - Quiz 15hard Data Types - Boolean type and logical operators - Quiz 13medium Data Types - Char type and Unicode behavior - Quiz 12easy Functions - Single-expression functions - Quiz 5medium Kotlin Basics and JVM Runtime - How Kotlin compiles to JVM bytecode - Quiz 14medium Null Safety - Safe call operator (?.) - Quiz 6medium Null Safety - Null safety in collections - Quiz 11easy Null Safety - Nullable types with ? suffix - Quiz 11easy