Using switch and do-while loops