Skip to content

Instantly share code, notes, and snippets.

@eight04
Created October 24, 2014 02:20
Show Gist options
  • Save eight04/4ce675452c2161fe3045 to your computer and use it in GitHub Desktop.
Save eight04/4ce675452c2161fe3045 to your computer and use it in GitHub Desktop.
[Less] Finding GCD
.gcd(@v1, @v2) when (@v1 < @v2) {
.gcd(@v1, @v2 - @v1);
}
.gcd(@v1, @v2) when (@v1 > @v2) {
.gcd(@v1 - @v2, @v2);
}
.gcd(@v1, @v2) when (@v1 = @v2){
@return: @v1;
}
.output {
.gcd(42, 56);
return: @return; // 14
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment