-
-
Notifications
You must be signed in to change notification settings - Fork 360
Adding Euclidean Algorithm in Lua #293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding Euclidean Algorithm in Lua #293
Conversation
local b = math.abs(b) | ||
|
||
while b ~= 0 do | ||
local temp = b |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know Lua, but a quick search shows me that you can assign pairwise variables, so maybe a, b = b, a%b
is cleaner
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ya I definitely agree its way cleaner that way. I just made a commit to adjust my code accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I request that you change one byte :)
@@ -68,6 +70,8 @@ Modern implementations, though, often use the modulus operator (%) like so | |||
[import:17-29, lang="swift"](code/swift/euclidean_algorithm.swift) | |||
{% sample lang="matlab" %} | |||
[import:19-31, lang="matlab"](code/matlab/euclidean.m) | |||
{% sample lang="lua" %} | |||
[import:16-27, lang="lua"](code/lua/euclidean.lua) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change the 27 to 25 and we're good to go!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I forgot to update the md file after the last commit. Just made a commit to fix this.
I've been learning a little bit of Lua. So I figured I should add some to the AAA.