I’ve noticed that Ben likes to place his variables within his functions right before they are used. I find that this style tends to confuse me a bit, so I’ve been sticking to my own formatting for variables.
For example, Ben’s variable formatting style:
void main()
{
string red = "red";
cout << red;
string blue = "blue";
cout << blue;
string yellow = "yellow";
cout << yellow;
}
My formatting style:
void main()
{
string red = "red";
string blue = "blue";
string yellow = "yellow";
cout << red;
cout << blue;
cout << yellow;
}
Basically, I just like to keep all the variables at the top of their scope in a list format. Both formats are perfectly fine, but some people may find mine helps them stay more organized. It’s all comes down to preference really. Hope this helps