I am trying to create a foreach loop within a while loop, and the issue is that the foreach loop executes completely, even if the condition to break the while loop has been met using one of the variables. I'm including source code to explain what is happening.

I want the while loop to stop after the `loop_e' > `total_e' the first time it happens (when the foreach loop loops over trunk). However, the while loop only stops executing after all the variables in the foreach loop have been looped over.

Code:
sysuse auto, clear
local total_e = 1e-2 
local loop_e = 1 

while `loop_e' > `total_e' {
    foreach var in trunk weight length turn {
        di "`var'"
        local loop_e = 1e-6 
    }
}