It's more common with other kinds of input streams. In this case, having the input operation as part of the condition means that the if statement will evaluate to false if you type something that isn't a number. More detail: http://www.lb-stuff.com/user-input