Objective-C: When to use braces in a For Loop declaration?

int example;
for (example = 0; example < 2; example++) {
NSLog(@"Value of example: %d", example);
NSLog(@"print a newline\n");
}
int example;
for (example = 0; example < 2; example++) {
NSLog(@"Value of example: %d", example);
}
int example;
for (example = 0; example < 2; example++)
NSLog(@"Value of example: %d", example);

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Akarsh SEGGEMU

Akarsh SEGGEMU

Software Engineer (Android, iOS, Unity) | M.Sc. Computer Science — Technische Universitaet Berlin | Mobile Advertising, Attribution, Monetisation, UA & Analytic