{} s olmadan döngüler ve if ifadeleri?

0 Cevap php

Onlar oldukça popüler ama ben bunları kullanmak için "topları" asla.

Onlar durdurmak nereye Temelde, ben asla bilemezsiniz. Onlar sadece kod sonraki satırını çalıştırmak mı?

Yaparsam:

for(int i = 0; i<10; i++)
    if(i % 2 == 0)
        //this is included in the for loop and the if statement
        function();

        // is this?
        function2();

    // where does it stop?
    function3();

Ne bir başka açıklama da dahil olmak üzere hakkında?

for(int i = 0; i<10; i++)
    if(i % 2 == 0)
        //this is included in the for loop and the if statement
        function();
    else
        // is this run as part of the for loop? even though theres a semi colon before it?
        function2();

Eğer bunu yaparsam ...

if((int)1 == (int)1) function1(); function2(); function3(); function4();

bu kod çalıştırmak hepsi bu?

ne bu konuda?

if((int)1 == (int)1) function();

function2();



function3();

Sadece kadar çalışır mı sonraki ;?

Teşekkürler Tom

0 Cevap