Loops and conditions are what make programming powerful. Some knowledge of logic may be required.
I see you put the conditions in (...), which is not strictly necessary. I have seen others do this and it may be habit as other languages require it.
I won't get into the spaces vs tabs indenting argument, but consistency is the most important thing.