r/backtickbot • u/backtickbot • Jun 01 '21
https://np.reddit.com/r/visualbasic/comments/npnvrt/art_of_code_pure_function/h077swr/
I'm sorry, I forgot to put then extension method into example code, it also an example for next post of this series.
Function [then](Of T)(ByRef Input As T, Update As T) As T
[then] = Input
Input = Update
End Function
Function gcd(A As Integer, B As Integer) As Integer
If A = 0 Or B = 0 Then Return 1
While B <> 0
B = A.then(B) Mod B
End While
Return A
End Functionint is Int64(Long), I'm alias it in project file(.vbproj) and forgot to replace it when use as example.
<Import Include="int = System.Int64" />
gcd I'm also sorry on this one too, it use to has at lease summary on it and I intent to rename it to greatest_common_divisor on this post.
I really sloppy on this post, I will double check it in next post, thanks for the help me. :)
1
Upvotes