Raskolnikov
2008-12-16 16:07:22
Okay, I am going to break it out. The appliances for members lately h
Begins and Repeats:
When I say always I mean ALWAYS. There is no exception to this rule
There are always two spaces on the line after a repeat too.
Let's review…
IS NOT CORRECT. The correct standards are:
More review:
IS NOT CORRECT. The correct standards are:
Okay, on to the next section
If then boolean statements:
Is correct. When using a begin the following is correct:
IS NOT CORRECT.
Another thing about if…or…then statements is this:
The reason for this is the statement that has the greatest chance of being correct is placed before the or, and the one with the least chance of being correct, is placed after the or.
Loops (while..do, for…to…do)
Most of the same rules stated above apply.
There are really no big exceptions to go over here.
Capitalization:
When Kaitneiks wrote down the standards, there is to be no unnecessary capitalization. For example:
Is not correct.
Is correct. Different people have different personal styles about capitalization, which is why I am going to brisk over it. I would recommend leaving anything in bold lowercase. If you develop your own style over time, go ahead.
Commas, Spaces, and Declaring Variables
Whenever you are declaring a variable, such as:
There must always be two spaces after the var! Also with a constant:
The same rules apply.
There must always be spaces after commas and arithmetic signs:
Is not correct.
Is not correct.
Get the idea?
Semicolons:
There should always be semicolons where they apply
There are never semicolons after bolded words, with the exception of end (which always has a semicolon or period to end the script)
After procedures/functions there must always be a semicolon. The only exception to this rule is the following:
Procedures/Functions
All procedures/functions should have names meaningful to their purpose:
For procedures/functions with parameters, the parameters of the same type should be lined up in one declaration on the line if possible. For example:
Is not correct. The correct thing is:
Do you see what I mean? There should be one declaration for all parameters belonging to one type.
All functions should return a result, or else they should be a procedure:
Is correct, we are actually returning something.
We aren't returning a result. The above should be:
Variables
Global variables (x, y, etc.) are frowned upon because they cause a longer waiting time. When you are able to, don't use global variables.
As well as global variables are frowned upon, so are one letter variables. Put some variety into your variables.
Some Tips:
Always include your standards while you script, it is a big time saver!
If you do have slightly varying standards then what I have posted, be sure that they are consistent!!!
Conclusion:
Good luck with standards. I know we can be picky arses about standards, so this is why I want to teach you so you don't get put down by others. When in doubt, ask an SRL member and they will help you :D. Please post suggestions, criticism, anything about this tutorial! Please rep ++ too please :D
Cut em2 it
ave had amazingly bad standards. I want to fix that. Here are some tips on what standards are so you aren't confused.Begins and Repeats:
procedure Hello;
begin
DoWhatever; //There are always two spaces on the line after the begin.
end;When I say always I mean ALWAYS. There is no exception to this rule
repeat
DoWhatever;
until(SomethingHappens);There are always two spaces on the line after a repeat too.
Let's review…
procedure Hello;
begin
DoWhatever;
end;IS NOT CORRECT. The correct standards are:
procedure Hello;
begin
DoWhatever;
end;More review:
repeat
DoWhatever;
until(SomethingHappens);IS NOT CORRECT. The correct standards are:
repeat
DoWhatever; //Two spaces!!!
until(SomethingHappens);Okay, on to the next section
If then boolean statements:
if Something then
DoWhatever; //Two spaces!!!Is correct. When using a begin the following is correct:
if Something then
begin //no spaces on the begin
DoWhatever; //Then we swoop in for the two spaces...
end; //then our endif Something then
begin
DoWhatever;
end;IS NOT CORRECT.
Another thing about if…or…then statements is this:
if (x < 7) or (SomeBoolean) then //is correctif (SomeBoolean) or (x < 7) then //is incorrectThe reason for this is the statement that has the greatest chance of being correct is placed before the or, and the one with the least chance of being correct, is placed after the or.
Loops (while..do, for…to…do)
Most of the same rules stated above apply.
while SomethingIsTrue do //no capitalization of the bolded words.
DoSomething; //same two space rulewhile SomethingIsTrue do
begin //no spaces on the begin
DoSomething;
Writeln('hello this is correct');
end;for i:=0 to 5 do
begin //no spaces on the begin
DoSomething; //same two space rule applies
Writeln('this is correct');
end;There are really no big exceptions to go over here.
Capitalization:
When Kaitneiks wrote down the standards, there is to be no unnecessary capitalization. For example:
Procedure Hello;Is not correct.
procedure Hello;Is correct. Different people have different personal styles about capitalization, which is why I am going to brisk over it. I would recommend leaving anything in bold lowercase. If you develop your own style over time, go ahead.
Commas, Spaces, and Declaring Variables
Whenever you are declaring a variable, such as:
var
Hello: string;There must always be two spaces after the var! Also with a constant:
const
WhatDoWeDo := 'mine';The same rules apply.
There must always be spaces after commas and arithmetic signs:
Mouse(x,y,2,2,true);Is not correct.
Point(5+4,9+2);Is not correct.
Mouse(x, y, 2, 2, true); //is correct
Point(5 + 4, 9 + 2); //is correctGet the idea?
Semicolons:
DoSomeStuff; //is correctThere should always be semicolons where they apply
if Something then; //is not correct!There are never semicolons after bolded words, with the exception of end (which always has a semicolon or period to end the script)
DoSomeStuff //is incorrect, you need a semicolon!After procedures/functions there must always be a semicolon. The only exception to this rule is the following:
if Something then //no begin, if there is a begin after this line, then there is a semicolon (on next line)
DoSomething //no semicolon!!!
else
DoSomethingElse; //now we can have a semicolonProcedures/Functions
All procedures/functions should have names meaningful to their purpose:
procedure CutTheWood; //is correctprocedure DoSomething; //is not correctFor procedures/functions with parameters, the parameters of the same type should be lined up in one declaration on the line if possible. For example:
procedure CutTheWood(Amount: integer; WaitTime: integer;);Is not correct. The correct thing is:
procedure CutTheWood(Amount, WaitTime: integer);Do you see what I mean? There should be one declaration for all parameters belonging to one type.
All functions should return a result, or else they should be a procedure:
function Hello: integer;
begin
Result := 5;
end;Is correct, we are actually returning something.
function Hello: integer;
begin
Mouse(x, y, 1, 1, true);
end;We aren't returning a result. The above should be:
procedure Hello;
begin
Mouse(x, y, 1, 1, true);
end;Variables
Global variables (x, y, etc.) are frowned upon because they cause a longer waiting time. When you are able to, don't use global variables.
As well as global variables are frowned upon, so are one letter variables. Put some variety into your variables.
Some Tips:
Always include your standards while you script, it is a big time saver!
If you do have slightly varying standards then what I have posted, be sure that they are consistent!!!
Conclusion:
Good luck with standards. I know we can be picky arses about standards, so this is why I want to teach you so you don't get put down by others. When in doubt, ask an SRL member and they will help you :D. Please post suggestions, criticism, anything about this tutorial! Please rep ++ too please :D
Cut em2 it