Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumSwiftautoclosureSingle-choice MCQ

How many times is `expensive()` evaluated, and what does it print overall?

func expensive() -> Int { print("computing") return 42 } func useIfNeeded(_ value: @autoclosure () -> Int, run: Bool) { if run { print(value()) print(value()) } } useIfNeeded(expensive(), run: true)