while and for working