Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
これら 2 つの while ループの違いは何ですか? 彼らが何をしているのか理解できません。
初め:
while(condition) ;
2番:
while(condition){ };
ループ自体は同じですが、2 番目のループの後に null ステートメントが続くため、このコードがより大きな制御構造の oart である場合、異なる方法で解析できます。たとえば、ネストされた 'if' ステートメントの一部である場合、最初の1 つは 'else' を続けることができましたが、2 番目はできませんでした。