<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://wiki.compsci.ca/skins/common/feed.css?270"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://wiki.compsci.ca/index.php?feed=atom&amp;target=Cavetroll&amp;title=Special%3AContributions%2FCavetroll</id>
		<title>Compsci.ca Wiki - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="http://wiki.compsci.ca/index.php?feed=atom&amp;target=Cavetroll&amp;title=Special%3AContributions%2FCavetroll"/>
		<link rel="alternate" type="text/html" href="http://wiki.compsci.ca/index.php?title=Special:Contributions/Cavetroll"/>
		<updated>2026-05-23T07:52:30Z</updated>
		<subtitle>From Compsci.ca Wiki</subtitle>
		<generator>MediaWiki 1.16.0</generator>

	<entry>
		<id>http://wiki.compsci.ca/index.php?title=Turing_Style_Guideline</id>
		<title>Turing Style Guideline</title>
		<link rel="alternate" type="text/html" href="http://wiki.compsci.ca/index.php?title=Turing_Style_Guideline"/>
				<updated>2008-10-11T14:36:52Z</updated>
		
		<summary type="html">&lt;p&gt;Cavetroll: /* Comments */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The following introduces a set of style guidelines to follow when writing [[Turing]] code.  Doing so will promote readability of code and positive communication between programmers.&lt;br /&gt;
&lt;br /&gt;
== Naming Conventions ==&lt;br /&gt;
&lt;br /&gt;
=== Constants ===&lt;br /&gt;
&lt;br /&gt;
Constants should be typed in all-caps, with underscores used to separate words.  For instance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;const FILE_PATH = &amp;quot;hello/world&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unless they have some obvious mathematical meaning, very short names should not be used.&lt;br /&gt;
&lt;br /&gt;
=== Variables, functions and procedures ===&lt;br /&gt;
&lt;br /&gt;
Variable, function and procedure names should begin with a lower-case letter.  Subsequent words should be separated either using an underscore, or by capitalization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;this_is_ok&lt;br /&gt;
thisToo&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Whichever style is chosen should be used consistently throughout a program.  As with constants, short variable names should be eschewed in favor of expressive variable names. &lt;br /&gt;
&lt;br /&gt;
Variable names should not be prefixed with any kind of indicator as to what type they are.  For instance, if one is writing a program which asks the user for a name, the following is considered bad form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;var sInput : string&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;var strInput : string&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Much better form would be something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;var usersName : string&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;var inputName : string&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functions which return boolean values should indicate that in some way.  Consider a function which tests if a string is empty.&lt;br /&gt;
&lt;br /&gt;
Bad:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;function empty (s : string) : boolean&lt;br /&gt;
   result s = &amp;quot;&amp;quot;&lt;br /&gt;
end empty&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The word &amp;quot;empty&amp;quot; in the English language can be used as a verb, yet we are not modifying the state of anything.  Much more appropriate would be something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;function is_empty (s : string) : boolean&lt;br /&gt;
   result s = &amp;quot;&amp;quot;&lt;br /&gt;
end empty&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will note that the argument to the function &amp;quot;is_empty&amp;quot; had a one character name.  Previously this was discouraged.  However, it should be noted that functions are meant to act as &amp;quot;black boxes&amp;quot; about whose implementation we do not need information.&lt;br /&gt;
&lt;br /&gt;
One of these pieces of information is the name of arguments.  Normally this would not be sufficient argument for shortening the name.  However, in this case the argument exists in a very small scope, and its purpose is not difficult to determine.&lt;br /&gt;
&lt;br /&gt;
=== Types ===&lt;br /&gt;
&lt;br /&gt;
The names of types should begin with a capital letter.  All subsequent words should be capitalized.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;ThisIsGood&lt;br /&gt;
AsIsThis&lt;br /&gt;
But_this_is_bad&lt;br /&gt;
andThisToo&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Comments ==&lt;br /&gt;
&lt;br /&gt;
First and foremost, comments should not be used to specify facts about a program which can be determined by simply reading the code.  Meaningful variable, function and procedure names should alleviate much of the need for comments.&lt;br /&gt;
&lt;br /&gt;
Bad:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;var name : string % name to be input by user&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Good:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;var nameInputByUser : string&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When comments are employed, they should take a very specific format.&lt;br /&gt;
&lt;br /&gt;
Comments should always precede the code to which they apply.&lt;br /&gt;
&lt;br /&gt;
Bad:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;something () % blah, blah&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Good:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;% blah, blah&lt;br /&gt;
something ()&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Comments should always be indented to match the indentation of the code they pertain to.&lt;br /&gt;
&lt;br /&gt;
Bad:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;% blah, blah&lt;br /&gt;
   something ()&lt;br /&gt;
   &lt;br /&gt;
   % yada, yada&lt;br /&gt;
 something_else ()&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Good:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;   % blah, blah&lt;br /&gt;
   something ()&lt;br /&gt;
   &lt;br /&gt;
 % yada, yada&lt;br /&gt;
 something_else ()&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
When commenting in this manner, it is best to separate the code to which the comment pertains from the rest of the code by a single blank line.&lt;br /&gt;
&lt;br /&gt;
Bad:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;% blah, blah&lt;br /&gt;
something ()&lt;br /&gt;
something_else ()&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Good:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;% blah, blah&lt;br /&gt;
something ()&lt;br /&gt;
&lt;br /&gt;
something_else ()&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Comments should be well-formed sentences.  They should be capitalized correctly, and contain proper spelling and punctuation.&lt;br /&gt;
&lt;br /&gt;
Comments should line-wrap as necessary to avoid the line they are on exceeding 80 columns wide.&lt;br /&gt;
&lt;br /&gt;
Comments should contain a single space between the comment delineator and the beginning of the comment.&lt;br /&gt;
&lt;br /&gt;
Bad:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;%foo&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Good:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;% foo&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Indentation ==&lt;br /&gt;
&lt;br /&gt;
The contents of functions, procedures, record declarations, classes, loops, conditions, case statements, etc. should all be indented.&lt;br /&gt;
&lt;br /&gt;
Indentation may be three spaces, four spaces, one tab, etc.  Whatever you choose to use, use it consistently.&lt;br /&gt;
&lt;br /&gt;
Bad:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;if someVariable = someOtherVariable then&lt;br /&gt;
 foo&lt;br /&gt;
 loop&lt;br /&gt;
 baz&lt;br /&gt;
 end loop&lt;br /&gt;
else &lt;br /&gt;
    bar&lt;br /&gt;
end if&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Good:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;if someVariable = someOtherVariable then&lt;br /&gt;
   foo&lt;br /&gt;
   &lt;br /&gt;
   loop&lt;br /&gt;
      baz&lt;br /&gt;
   end loop&lt;br /&gt;
else &lt;br /&gt;
   bar&lt;br /&gt;
end if&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Control Structures and Whitespace ==&lt;br /&gt;
&lt;br /&gt;
It is immensely helpful to separate control structures (conditionals or loops) from surrounding code at the same levek of indentation with a single blank line. &lt;br /&gt;
Bad:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;foo&lt;br /&gt;
if bar then&lt;br /&gt;
   baz&lt;br /&gt;
end if&lt;br /&gt;
loop&lt;br /&gt;
   qux&lt;br /&gt;
end loop&lt;br /&gt;
wooble&lt;br /&gt;
ninja&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Good:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;foo&lt;br /&gt;
&lt;br /&gt;
if bar then&lt;br /&gt;
   baz&lt;br /&gt;
end if&lt;br /&gt;
&lt;br /&gt;
loop&lt;br /&gt;
   qux&lt;br /&gt;
end loop&lt;br /&gt;
&lt;br /&gt;
wooble&lt;br /&gt;
ninja&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Variable Declarations and Whitespace ==&lt;br /&gt;
&lt;br /&gt;
Multiple variable declarations may appear on adjacent lines.  However, they should be separated from surrounding code at the same indentation level by a blank line.&lt;br /&gt;
&lt;br /&gt;
Bad:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;var x : int&lt;br /&gt;
var y : string&lt;br /&gt;
get x&lt;br /&gt;
get y&lt;br /&gt;
put y ..&lt;br /&gt;
put x&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Good:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;var x : int&lt;br /&gt;
var y : string&lt;br /&gt;
&lt;br /&gt;
get x&lt;br /&gt;
get y&lt;br /&gt;
put y ..&lt;br /&gt;
put x&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Scope ==&lt;br /&gt;
&lt;br /&gt;
Variables should be scoped as minimally as possible.  If a variable is only used within a conditional structure or loop, then it should be scoped to that structure.&lt;br /&gt;
&lt;br /&gt;
Bad:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;var x : int&lt;br /&gt;
&lt;br /&gt;
if true then&lt;br /&gt;
   get x&lt;br /&gt;
   put x&lt;br /&gt;
end if&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Good:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;if true then&lt;br /&gt;
   var x : int&lt;br /&gt;
&lt;br /&gt;
   get x&lt;br /&gt;
   put x&lt;br /&gt;
end if&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous Whitespace Issues ==&lt;br /&gt;
&lt;br /&gt;
In a variable declaration, whitespace should always separate commas, colons and initialization.&lt;br /&gt;
&lt;br /&gt;
Bad:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;var x,y:int&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;var x:int:=0&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Good:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;var x, y : int&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;var x : int := 0&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Operators should benefit from whitespace.  Leaving whitespace out will not make your code magically faster.&lt;br /&gt;
 &lt;br /&gt;
Bad:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;x-y+z*4&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Good:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;x - y + z * 4&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Do not place whitespace directly inside parentheses.&lt;br /&gt;
&lt;br /&gt;
Bad:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;( x - y + z ) * 4&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Good:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;(x - y + z) * 4&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Do use blank lines to separate functions, procedures, records and processes.&lt;br /&gt;
&lt;br /&gt;
Bad:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;type A : &lt;br /&gt;
   record &lt;br /&gt;
      b : string&lt;br /&gt;
   end record&lt;br /&gt;
function foo : string&lt;br /&gt;
   result &amp;quot;foo&amp;quot;&lt;br /&gt;
end foo&lt;br /&gt;
procedure bar &lt;br /&gt;
   baz&lt;br /&gt;
end bar&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Good:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;type A : &lt;br /&gt;
   record &lt;br /&gt;
      b : string&lt;br /&gt;
   end record&lt;br /&gt;
&lt;br /&gt;
function foo : string&lt;br /&gt;
   result &amp;quot;foo&amp;quot;&lt;br /&gt;
end foo&lt;br /&gt;
&lt;br /&gt;
procedure bar &lt;br /&gt;
   baz&lt;br /&gt;
end bar&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The same rules that hold for variable declarations apply for function, procedure and process parameter lists.&lt;br /&gt;
&lt;br /&gt;
Bad:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;function foo (bar:string) : string&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Good:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;function foo (bar : string) : string&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similarly, the colon leading the return type in a function should be surrounded by whitespace.&lt;br /&gt;
&lt;br /&gt;
Bad:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;function foo (bar : string):string&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Good:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;function foo (bar : string) : string&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a call of a function, procedure or process, arguments should be separated by whitespace.  Again, leaving out the whitespace does nothing to make code better, and does make it harder to read.&lt;br /&gt;
&lt;br /&gt;
Bad:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;foo (42,27)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Good:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;foo (42, 27)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code Organization ==&lt;br /&gt;
&lt;br /&gt;
Turing, unlike many other statically, manifestly typed programming languages, does not have a designated entry point.  &lt;br /&gt;
&lt;br /&gt;
Code that can be executed is, in order, as it appears in the source code.  This means such things can be interspersed with type, function, procedure and process definitions.&lt;br /&gt;
&lt;br /&gt;
Despite the fact that this can be done, does not mean it should.&lt;br /&gt;
&lt;br /&gt;
Bad:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;var userInputString : string&lt;br /&gt;
&lt;br /&gt;
function getString : string&lt;br /&gt;
   var s : string&lt;br /&gt;
    &lt;br /&gt;
   get s ..&lt;br /&gt;
   result s&lt;br /&gt;
end getString&lt;br /&gt;
&lt;br /&gt;
userInputString := getString&lt;br /&gt;
&lt;br /&gt;
function reverseString (stringToReverse : string) : string&lt;br /&gt;
   var outputString : string := &amp;quot;&amp;quot;&lt;br /&gt;
   &lt;br /&gt;
   for decreasing characterIndex : length (stringToReverse) .. 1&lt;br /&gt;
      outputString += stringToReverse (characterIndex)&lt;br /&gt;
   end for&lt;br /&gt;
   &lt;br /&gt;
   result outputString&lt;br /&gt;
end reverseString&lt;br /&gt;
&lt;br /&gt;
put reverseString (userInputString)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Good:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;function getString : string&lt;br /&gt;
   var s : string&lt;br /&gt;
    &lt;br /&gt;
   get s ..&lt;br /&gt;
   result s&lt;br /&gt;
end getString&lt;br /&gt;
&lt;br /&gt;
function reverseString (stringToReverse : string) : string&lt;br /&gt;
   var outputString : string := &amp;quot;&amp;quot;&lt;br /&gt;
   &lt;br /&gt;
   for decreasing characterIndex : length (stringToReverse) .. 1&lt;br /&gt;
      outputString += stringToReverse (characterIndex)&lt;br /&gt;
   end for&lt;br /&gt;
   &lt;br /&gt;
   result outputString&lt;br /&gt;
end reverseString&lt;br /&gt;
&lt;br /&gt;
var userInputString : string&lt;br /&gt;
&lt;br /&gt;
userInputString := getString&lt;br /&gt;
put reverseString (userInputString)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Additionally, so that they are available to the rest of the code, type declarations should appear at the top of your code.&lt;br /&gt;
&lt;br /&gt;
== Functions vs. Procedures: Two Enter. One Leaves. ==&lt;br /&gt;
&lt;br /&gt;
Procedures are probably what every Turing programmer is first introduced to in terms of organizing executable code.  As it happens, they are also one of the first things that should, for the most part, be left behind.&lt;br /&gt;
&lt;br /&gt;
Procedures typically act on some set of global variables.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;var foo : int := 0&lt;br /&gt;
&lt;br /&gt;
procedure bar &lt;br /&gt;
   foo += 1&lt;br /&gt;
end bar&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You may note that this directly contradicts the style promoted in the Code Organization section.  There was good reason for the style advocated there.  A variable declared after a procedure is not visible to that procedure's inner workings.&lt;br /&gt;
&lt;br /&gt;
The following would result in an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;procedure bar &lt;br /&gt;
   foo += 1&lt;br /&gt;
end bar&lt;br /&gt;
&lt;br /&gt;
var foo : int := 0&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The problem with procedures is that they explicitly refer to some set of variables outside their own scope.  They are tied down to using just those variables.  They are also dependent on those variables for their internal behavior.&lt;br /&gt;
&lt;br /&gt;
A function's implementation, on the other hand, is separate from its external environment.  It communicates with the outside world via the arguments passed into it, and the value it returns.&lt;br /&gt;
&lt;br /&gt;
Whenever possible, seek a solution which uses functions rather than procedures.&lt;br /&gt;
&lt;br /&gt;
== Conditionals and Redundancy ==&lt;br /&gt;
&lt;br /&gt;
If, in the course of writing a conditional, you find that multiple branches have the exact same result, then you almost certainly should use &amp;quot;or&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Bad:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;if foo = &amp;quot;bar&amp;quot; then&lt;br /&gt;
   result 42&lt;br /&gt;
elsif foo = &amp;quot;baz&amp;quot; then&lt;br /&gt;
   result 42&lt;br /&gt;
else&lt;br /&gt;
   result 27&lt;br /&gt;
end if&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Good:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;if foo = &amp;quot;bar&amp;quot; or foo = &amp;quot;baz&amp;quot; then&lt;br /&gt;
   result 42&lt;br /&gt;
else&lt;br /&gt;
   result 27&lt;br /&gt;
end if&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is bad practice to use multiple conditionals when the results are exclusive.  That is, if only one of them will actually run, you should use a single conditional with multiple branches.&lt;br /&gt;
&lt;br /&gt;
Bad:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;if foo = &amp;quot;bar&amp;quot; then&lt;br /&gt;
   bar := 42&lt;br /&gt;
end if&lt;br /&gt;
&lt;br /&gt;
if foo = &amp;quot;baz&amp;quot; then&lt;br /&gt;
   bar := 27&lt;br /&gt;
end if&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Good:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;if foo = &amp;quot;bar&amp;quot; then&lt;br /&gt;
   bar := 42&lt;br /&gt;
elsif foo = &amp;quot;baz&amp;quot; then&lt;br /&gt;
   bar := 27&lt;br /&gt;
end if&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Conditionals and Control Flow ==&lt;br /&gt;
&lt;br /&gt;
It is bad practice to use a conditional to break control flow and skip around the remainder of the function or procedure, if the same can be expressed as a conditional with multiple branches.&lt;br /&gt;
&lt;br /&gt;
This practice technically works fine, but makes it more tedious to reason about the control flow, and yields no significant gain.&lt;br /&gt;
&lt;br /&gt;
Bad:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;function foo (bar : int) : int&lt;br /&gt;
   if bar &amp;lt; 27 then&lt;br /&gt;
      result 3&lt;br /&gt;
   end if&lt;br /&gt;
&lt;br /&gt;
   result 2&lt;br /&gt;
end if&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Good:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;function foo (bar : int) : int&lt;br /&gt;
   if bar &amp;lt; 27 then&lt;br /&gt;
      result 3&lt;br /&gt;
   else&lt;br /&gt;
      result 2&lt;br /&gt;
   end if&lt;br /&gt;
end if&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that this practice may be used within a loop, to implement short-circuiting behavior.&lt;/div&gt;</summary>
		<author><name>Cavetroll</name></author>	</entry>

	</feed>