Thank you.sai rama krishna wrote:Looks interesting. . . .
Only in theory. Remember that under the principles of structured programming, multiple return is never necessary, but most people see no harm in it.Is it bad thing to have multiple returns?
Try it and see.Can I use for loop instead of while loop here?
Remember the while loop is the most basic type in theory and all other loops are derivatory forms. So, no. You can write a while loop to cover just about every case of iteration but trying to do it with a different kind of loop can be very awkward at best.can I use for loop interchangeably wherever while is used . . .
In which case it would be good for you to learn the other kinds of iteration (for, for‑each, while, do‑while, with and without Iterators), recursion, and Streams.I got used to for loop more than while loop
sai rama krishna wrote:Is it bad thing to have multiple returns?
sai rama krishna wrote:I never saw &= operator. What this represent?
If number of lines more if we put more return statements visibility is lost right?
What is meaning of guard clauses? Can you please give some simple example for that?
sai rama krishna wrote:"a &= b" is the same as "a = a & b" right not a && b? This is first time I ever saw this expression. Is it in new edition of java?
Gaurd clause is same as edge case? I hear people calling edge case for similar check at the beginning of method.
I have never considered that question; I can only remember using &= once more than Paul Csai rama krishna wrote:. . . "a &= b" is the same as "a = a & b" right not a && b? . . .
AssignmentOperator:
(one of)
= *= /= %= += -= <<= >>= >>>= &= ^= |=
sai rama krishna wrote:
AssignmentOperator:
(one of)
= *= /= %= += -= <<= >>= >>>= &= ^= |=
People use += frequently. As we have found, some of the others are used but very rarely.Paul Clapham wrote:. . . I may have used one or two of those in the past... . . .