For loop to while in lasso