0

[ANSWERED]Braces

Is there any difference in writing if-sentence with or without {}?

30th Mar 2017, 8:35 PM
Alex Snaidars
Alex Snaidars - avatar
3 Respuestas
+ 10
If you don't write the braces, it will only execute the first statement after the "if". Including them executes all of the statements within the braces. You normally include them if you have only one statement to be executed by the if statement.
30th Mar 2017, 8:41 PM
J.G.
J.G. - avatar
+ 2
language? also the code playground is a great place to simply test it yourself
30th Mar 2017, 8:37 PM
Tob
Tob - avatar
0
@Tobi Edited I just can't test it for everything
30th Mar 2017, 8:38 PM
Alex Snaidars
Alex Snaidars - avatar