We read your photo as:
To identify the Kotlin feature that allows for more compact function declarations by omitting curly braces and the return keyword for single-expression functions. The example clearly shows a functio
Computer Science
ScanSolve AI Answer
The question asks to identify the Kotlin feature that allows for more compact function declarations by omitting curly braces and the return keyword for single-expression functions. The example clearly shows a function fun sum(a: Int, b: Int): Int = a + b which uses an equals sign (=) to directly assign the result of an expression as the function's body.
This specific syntax is known as an expression body in Kotlin. It is used when a function's body consists of a single expression, making the code more concise.
Let's evaluate the options:
- Simplified Formatting: This is a general description, not the specific technical term.
- Expression Body Syntax: This is the correct technical term for functions whose bodies are a single expression, using the
=operator. - Compact Functionality: This is a general description, not a specific Kotlin feature name.
- Concise Structure: Similar to "Simplified Formatting" and "Compact Functionality", this is a general description.
The correct option is Expression Body Syntax.
Was this helpful?
Still stuck on this one?
Ask a follow-up, and the answer starts from this question.
Got a different question?Ask your own question
More Computer Science Questions
QTo choose the best description of a 'function' in Kotlin.QWhat is the purpose of the main function in Kotlin?QWhich of the following are correct Kotlin variable declarations? Select all that apply. kotlin //…QThe primary purpose of the main function in Kotlin is to serve as the entry point for the program…QWhich Kotlin function allows you to filter elements of a collection based on a specified condition.