Beginner
Go (Golang)
Q28 / 100
What does the init() function do?
Correct! Well done.
Incorrect.
The correct answer is B) Runs automatically before main() for package initialization
B
Correct Answer
Runs automatically before main() for package initialization
Explanation
init() is called automatically after all variable declarations in the package. A package can have multiple init() functions.
Progress
28/100