repeat loop inside Vstack

I'm trying to get my App to update precentage level by making a loop inside Vstack, but I get an error as follows.

VStack {

repeat { 'Closure containing control flow statement cannot be used with result builder'ViewBuilder''.

let baprs = readlevel(battprs: "")

Text("(baprs)")

} while k == 0

          .font(.system(size: 14))

          .bold()

          .offset(y: 40)

        Text("%")

         .font(.system(size: 14))

          .bold()                       .offset(x: 20, y: 6)       }

I don't understand your code.

where is k initialised ?

where is it updated ?

Could you show the complete real code, properly formatted and tell what is the exact error you get, where ?

However, message is explicit, this pattern is forbidden.

But you could write something like:

struct ContentView: View {
    
    var body: some View {
        VStack {
            ForEach (0..<2) {
                Text("Hello \($0)")
            }
        }
    }
}
repeat loop inside Vstack
 
 
Q