+ 3

For with {} and without

Ive seen people use the for loop with {} and ive seen people use it without what does it change if u put it or not (the "{}" i mean)

5th Sep 2018, 7:32 PM
BeastMaster64
BeastMaster64 - avatar
3 Respostas
+ 8
without braces i believe you can only have one statement inside the loop
5th Sep 2018, 7:33 PM
hinanawi
hinanawi - avatar
+ 5
no braces (on non indentation based languages such as python) will allow you to have one statement just as hinanawi stated take a look at this (short) article: https://medium.com/@jonathanabrams/single-line-if-statements-2565c62ff492
5th Sep 2018, 9:32 PM
Burey
Burey - avatar
+ 1
thanks to both of you
6th Sep 2018, 9:38 AM
BeastMaster64
BeastMaster64 - avatar