objective c - error: expected expression before 'else' -


i making button pauses , plays sound. here coding:

.h:

@interface rootviewcontroller : uiviewcontroller { }  @property (nonatomic, retain) avaudioplayer *theaudio; -(ibaction)pause;  @end 

.m:

- (void)viewdidload {     nsstring *path = [[nsbundle mainbundle] pathforresource:@"mathmusic1" oftype:@"wav"];     self.theaudio = [[[avaudioplayer alloc] initwithcontentsofurl:[nsurl fileurlwithpath:path] error:null] autorelease];     theaudio.delegate = self;     [theaudio play];     theaudio.numberofloops = -1;      [super viewdidload];   } 

now trying make button pause here coding: (already declared in .h)

-(ibaction)pause {      [theaudio pause];         else // expected expression before 'else'     [theaudio play];  } 

/ error: expected expression before 'else'

there else without if (just before), think may error in code.


Comments