Why this fires¶
A break carrying a value targets while or for. Only the unconditional
loop form is a value-producing expression.
while ready() {
break 1 // error[TE228]
}Fix it¶
Remove the value, assign it before breaking, or use a value-producing loop.
let answer: int = loop {
break 1
}See also¶
TE229— break values disagree with a loop's result type.