renamed to loops, added scala while loop