While loops

While loops

local n = 1
while `n' <= 10 {			
	// While just evaluates a general condition and does not automatically create a local.
	display `n'
	local n = `n' + 1 
}
	
local n = 1
while `n' <= 10 {
	display `n'
	local ++n				
	// You may know this from other programming languages, it is identical to writing local n = `n' + 1.
}

// Example: loop over regressions and stop when a certain result occurs