0
0
Kotlinprogramming~10 mins

Comments and documentation syntax in Kotlin - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to write a single-line comment in Kotlin.

Kotlin
//[1] This is a comment
Drag options to blanks, or click blank then click option'
A This is a single-line
B This is a
C This is
D This is a single-line comment
Attempts:
3 left
💡 Hint
Common Mistakes
Using /* */ for single-line comments
Forgetting the slashes at the start
2fill in blank
medium

Complete the code to write a multi-line comment in Kotlin.

Kotlin
/*[1]
This is a multi-line comment
*/
Drag options to blanks, or click blank then click option'
A This is a multi-line comment
B This is a multi-line comment start
C This is a multi-line comment block
D This is a multi-line comment example
Attempts:
3 left
💡 Hint
Common Mistakes
Using // for multi-line comments
Not closing the comment with */
3fill in blank
hard

Fix the error in the Kotlin documentation comment syntax.

Kotlin
/**[1]
 * This function adds two numbers.
 */
Drag options to blanks, or click blank then click option'
A This is a single-line comment
B This is a normal comment
C This is a multi-line comment
D This is a documentation comment
Attempts:
3 left
💡 Hint
Common Mistakes
Using /* instead of /** for documentation comments
Confusing documentation comments with normal comments
4fill in blank
hard

Fill both blanks to create a Kotlin documentation comment for a function.

Kotlin
/**
 * [1] adds two integers.
 * @param [2] first number
 */
Drag options to blanks, or click blank then click option'
AThis function
Bnum1
Cnumber1
DAdds
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong parameter names in @param
Not describing the function clearly
5fill in blank
hard

Fill all three blanks to complete the Kotlin documentation comment with description, parameter, and return tag.

Kotlin
/**
 * [1] multiplies two numbers.
 * @param [2] first number
 * @return [3] the product
 */
Drag options to blanks, or click blank then click option'
AThis function
BnumA
Cthe result
DnumB
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing parameter names
Forgetting the @return tag