Do you have any?
I'll start off. This applies to any languages as well, but I'll use C++ as an example:
[PHP]
bool freedompeace = true;
if (freedompeace)
{
ExitWindows(0,0);
}
else
{
// do nothing
}
[/PHP]
There is NO need to have the entire "else do nothing" -
it already does that! It's really annoying when I'm helping someone debug code and I see a matching else-do-nothing statement for every if statement.
Also, comments, in C# this time.
[php]
/*******************************************
* Create a new random variable
*******************************************/
Random random = new Random();
/*******************************************
* Create a new integer variable and assign it to a random number
*******************************************/
int temporary_number = random.Next();
/*******************************************
* Multiply our number by two
*******************************************/
temporary_number = temporary_number * 2;
/*******************************************
* Write our output to the console in a new line
*******************************************/
Console.WriteLine("Output is " + temporary_number);
/*******************************************
* Return zero.
*******************************************/
return 0;
[/php]
I KNOW what's going on, you don't need to TELL me AGAIN. It's in plain English, almost.
And that's not that bad, do ALL the above, PLUS separate every line with a break.
So:
[php]
/*******************************************
* Create a new random variable
*******************************************/
Random random = new Random();
/*******************************************
* Create a new integer variable and assign it to a random number
*******************************************/
int temporary_number = random.Next();
/*******************************************
* If the temporary number is more than 5
*******************************************/
if (temporary_number > 5)
{
/*******************************************
* Multiply our number by two
*******************************************/
temporary_number = temporary_number * 2;
/*******************************************
* Write our output to the console in a new line
*******************************************/
Console.WriteLine("Output is " + temporary_number);
}
/*******************************************
* else
*******************************************/
else
{
// do nothing
}
/*******************************************
* Return zero.
*******************************************/
return 0;
[/php]
Post yours
