Uploader Comments (mybringback)
All Comments (6)
-
What if i want so make something that says if your an adult or a kid or a senior.
I dont get how i use the comparison operators to say from 18-65 is adult. 18 or younger and 65 and older is easy. But how do you state from one age to another?
-
@brandongrenet If I am understanding you correctly you wrote your code without the { } characters in your if/else statements.
Such as: if (age >= 18) NSLog(@"Eligible"); else NSLog(@"Not Eligible");
The reason this works the same as if you had included { } characters around each NSLog statement is that your code only included a single statement in each if/else branch. If you wanted to do more in either if/else branch, you would need to surround the branch code with { } chars.
-
Nice video, any examples on how I could use that in a ipad/iphone app? (not age related though) like "if click here put them here, else leave them" or something
-
great videos
I am a beginner and I was wondering why do we need to put { } at the start and end of NSLog? it seems to run without it?
brandongrenet 3 months ago
@brandongrenet good question. the { } are actually containers for the if/else functions. anything contained within the brackets will be executed for the if/else. the { } aren't directly related to NSLog. hopefully that helps!
mybringback 3 months ago