Can we use (id) in if- else condition ?

Posted by srikanth rongali on Stack Overflow See other posts from Stack Overflow or by srikanth rongali
Published on 2010-04-06T06:49:21Z Indexed on 2010/04/06 6:53 UTC
Read the original article Hit count: 142

I have written my code in following way in cocos2d.

id actionTo = [CCFadeOut actionWithDuration:4.0f];  
id actionTo0 = [CCSequence actionWithDuration:2.0f];
if (m < enemyNumber)
    id actionTo1 = [CCCallFunc actionWithTarget:self selector:@selector(goToNextScene)];
else
    id actionTo1 = [CCCallFunc actionWithTarget:self selector:@selector(goToEndScene)];
id actionSeq = [CCSequence actions:actionTo, actionTo0, actionTo1, nil];
[targetE runAction: [CCSequence actions:actionSeq, nil]];  

error: expected expression before 'id'  

I am getting the above error. Should not we use (id) in if condition ? I want to get called two selectors by using the if- else condition. How can I make it ? Thank You.

© Stack Overflow or respective owner

Related posts about cocos2d

Related posts about objective-c