Skip to content

Instantly share code, notes, and snippets.

@sometowngeek
Created July 30, 2017 17:18
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save sometowngeek/10ac5deb21e11698eb52f1356cee5d57 to your computer and use it in GitHub Desktop.
namespace YouNameThisNamespace
{
public class ExampleClass
{
public static int GetGCF(int num1, int num2)
{
// Declare variables
int a = num1;
int b = num2;
int r = 0;
// Action 1
while (a > 0 && b > 0)
{
r = a % b;
a = b;
b = r;
}
// Action 2
return a > 0 ? a : b;
}
}
}
This is how most developers usually do it.
Notice there is only one extra spacing between different clusters.
Declarations, space, action, space, action, and so on.
There aren't any extra spacings before or after curly braces either, except where
it ends the action, declaration, or whatever cluster.
Hope this makes sense :)
-Sometowngeek
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment