little question, big problem

krilos:
why does it go to the begining and doesn't go the "if" it belongs as i thought??.

How would the code know what belongs with the if-statement. If-statements are a on time instruction, like most statements. You must use a loop to repeat it.