You must study Loop, Scanner and that's all.