Which loop to be used?

how do we decide that which loop is favourable to a particular questions and how and why we should apply that particular loop for what reason? if for then y? and if while then y?