Sha256: c6eaa5bfedc48e052237404d7478973695d76b1c49b7c0cd2e80e74d3c2b6fb2

Contents?: true

Size: 603 Bytes

Versions: 43

Compression:

Stored size: 603 Bytes

Contents

// JavaScript Lint (http://www.JavaScriptLint.com/)
//
// This function is supposed to find the difference between two numbers,
// but it has some bugs! (And JavaScript Lint can help you find them!)

/*jsl:option explicit*/
function subtract(x,y) {
    // optimize for equal values
    if (x = y) {
        return 0;
    }

    // don't allow negative return value
    if (x < x) {
        return null;
    }

    // optimize for some common subtractions
    switch (y) {
    case 0: z = x;
    case 1: z = --x;
        return z;
    }

    // finally, resort to actual subtraction!
    return; x-y;
}

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
distil-0.14.5.a vendor/jsl-0.3.0/src/jsl-test.js
distil-0.14.4 vendor/jsl-0.3.0/src/jsl-test.js
distil-0.14.3 vendor/jsl-0.3.0/src/jsl-test.js
distil-0.14.2 vendor/jsl-0.3.0/src/jsl-test.js
distil-0.14.2.a vendor/jsl-0.3.0/src/jsl-test.js
distil-0.14.1 vendor/jsl-0.3.0/src/jsl-test.js
distil-0.14.1.a vendor/jsl-0.3.0/src/jsl-test.js
distil-0.14.0 vendor/jsl-0.3.0/src/jsl-test.js
distil-0.14.0.i vendor/jsl-0.3.0/src/jsl-test.js
distil-0.14.0.h vendor/jsl-0.3.0/src/jsl-test.js
distil-0.14.0.g vendor/jsl-0.3.0/src/jsl-test.js
distil-0.14.0.d vendor/jsl-0.3.0/src/jsl-test.js
distil-0.14.0.c vendor/jsl-0.3.0/src/jsl-test.js
distil-0.14.0.b vendor/jsl-0.3.0/src/jsl-test.js
distil-0.13.6 vendor/jsl-0.3.0/src/jsl-test.js
distil-0.13.5 vendor/jsl-0.3.0/src/jsl-test.js
distil-0.13.4 vendor/jsl-0.3.0/src/jsl-test.js
distil-0.13.3 vendor/jsl-0.3.0/src/jsl-test.js
distil-0.13.2 vendor/jsl-0.3.0/src/jsl-test.js
distil-0.13.1 vendor/jsl-0.3.0/src/jsl-test.js