The Dink Network

Reply to Re: Procedure opening/closing brackets

If you don't have an account, just leave the password field blank.
Username:
Password:
Subject:
Antispam: Enter Dink Smallwood's last name (surname) below.
Formatting: :) :( ;( :P ;) :D >( : :s :O evil cat blood
Bold font Italic font hyperlink Code tags
Message:
 
 
September 24th 2005, 04:36 PM
fish.gif
Simeon
Peasant He/Him Netherlands
Any fool can use a computer. Many do. 
Well, when the body of the if-statement is only one command/expression/whatever, you don't necessarily need them because that's part of the syntax. But the body can also have more commands/expressions/etc and then you need them because otherwise, the engine/compiler doesn't know they're all part of the body of the if-statement

We're doing that @ uni these days so that's why You can consistently use brackets only when necessary (so not when there's only 1 thing in the if-statement's body) but on the other hand, it's generally better to use them everywhere because you can see at all times what starts and ends where (and, if you wanted to add something else, you'd need to add those brackets again to make sure it functions properly - and, when you forget that, you'd wonder why it's not working right )