+ 1
Can some explain this one?
These 2 codes are equivalent? 1. While(abc) System.out.print("hi"); 2. If(abc) System.out.print("hi"); Ignore syntax if any
3 Antworten
+ 1
Nope, the first will continue printing while <abc> can be evaluated as true. The second will decide whether or not to print deoending on whether <abc> was true.
+ 1
Ah, means if abc is true, the first will run infinity, the second just run once
0
Yes, except something changes <abc> to false in while...loop body, it will run infinitely.