Skip to content
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

Improve algorithm to check RUT number #3

Open
wants to merge 1 commit into
base: 10.0
Choose a base branch
from

Commits on Feb 11, 2019

  1. Simplify algorithm to check RUT number

    Previous code tried to apply the algorithm as described in the Wikipedia, and therefore the code was unnecessarily complex because it did the sum from the end of the RUT number, but when coding it is easier to sum from the beginning.
    
    Also:
    
    * Remove unnecesary variable initialization,
    * Postpone variable creation until they are strictly necessary,
    * Put abort earlys at top,
    * Remove unnecessary exception checking,
    * Return directly the value of the comparison instead of using if..elif, and
    * Add constants for the factors instead of creating them on runtime every time the method is called.
    unho authored Feb 11, 2019
    Configuration menu
    Copy the full SHA
    617a647 View commit details
    Browse the repository at this point in the history