For with {} and without | Sololearn: Learn to code for FREE!

+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)

9/5/2018 7:32:32 PM

BeastMaster64

3 Answers

New Answer

+8

without braces i believe you can only have one statement inside the loop

+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

+1

thanks to both of you