implemented do-while