for and while gen