PDA

View Full Version : if condition statement


pitale
04-10-2010, 11:49 AM
i am trying to sort out the meaning between these 2 ways of code written format
1.
if (snowFactor > 100) snowA._alpha = snowB._alpha = snowFactor

2.
if (snowFactor > 100) {
snowA._alpha = snowB._alpha = snowFactor
}

Is it the same? The first one has no parenthesis. Why is that?

D-Mx
04-10-2010, 06:55 PM
Its the same, The use for { } is when you want to include more than 1 line inside the if, cuz without them it will only include the next line but since in both you have one instructon in it makes no difference

hope i explained well :)