Loop problem in method calling

I put all code ,but in if condition I write || because I just need one value.