Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumSwiftresult buildersSingle-choice MCQ

Given this result builder, what does `buildEither` enable and how is it used for the `if/else` below?

@resultBuilder struct StringBuilder { static func buildBlock(_ parts: String...) -> String { parts.joined() } static func buildEither(first: String) -> String { first } static func buildEither(second: String) -> String { second } } @StringBuilder func make(flag: Bool) -> String { if flag { "yes" } else { "no" } }