Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

GCD function (See related posts)

    gcd: func [
        {Returns the greatest common denominator of m and n.}
        m [integer!]
        n [integer!]
    ][
        ;Euclid's algorithm
        abs either zero? n [0] [either zero? (m // n) [n] [gcd n (m // n)]]
    ]

You need to create an account or log in to post comments to this site.


Click here to browse all 5140 code snippets

Related Posts