Studerade lite öpen källkod (Java) och fick se på detta:
public int pieceCount() {
int c = 0;
for (int i=0;i<8;i++)
for (int j=0;j<8;j++)
if (state[i][j] == PIECE) c++; // Using another programming language :)
return c;
}
Tyckte det var lite roligt men det är säkert för att man är lite skadad :e
// Throw an exception
Exception up = new Exception("Something is really wrong.");
throw up; // ha ha
// Catch an exception
try {
y = 0;
x = 10 / y;
}
catch (Exception ex) { // Argument is optional, no "When" keyword
Console.WriteLine(ex.Message);
}
finally {
// Requires reference to the Microsoft.VisualBasic.dll
// assembly (pre .NET Framework v2.0)
Microsoft.VisualBasic.Interaction.Beep();
}