0
Where or when to put brackets when i making programs?
i can learn c# and codes but the only problem is where or when to put brackets when i making programs?
1 Respuesta
+ 3
You put brackets, that is { and }, to close a block of code.
I.e. the code that makes a full class is closed in brackets (but you live the declaration of the class outside the brackets).
The same with a function and with a loop.
Example:
class a
{
    void function b()
    {
        for (x = 0; x < 10; x++)
        {
            // some code hare...
        }
    }
}
As you can see, the for loop's code is closed with brackets. So is the code block of the B function and the code block of the A class.
Hope it makes more sense now.
Ronen





