It's kind of hard to exactly search for this. I've seen this in a few places and I've even tried it in code to see how it works but just so that I know exactly how they can be used and to make sure I wont be abusing them I thought i'd ask on here.
public void doSomethingSpecial()
{
String strHello = null;
// What is the following section in braces for
{
strHello = "Hello World"
}
for(int i = 0; i < 10; i++)
{
// What is the significance of them it in a loop?
{
strHello = "Hello";
// Do something else...
}
.
.
.
}
}
- Can someone clarify what these brace blocks braces are for?
- I assume they work like a method and would restrict the scope of anything within as long as it isn't specified outside the block, but is there another use?
- What is the exact name for them?
Thanks in advance