Gravity crash

  1. 5 years ago

    Joel_Eisenstat

    17 Jul 2018 User since 2016

    Good afternoon,
    This code causes Creo to hang - beachball - force quit is required, otherwise no code errors given.

    //test nomenclature conversion
    var int_teeth = [0,18,17,16,15,14,13,12,11,21,22,23,24,25,26,27,28,38,37,36,35,34,33,32,31,41,42,43,44,45,46,47,48];
    var amer_teeth = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,2,5,26,27,28,29,30,31,32]

    var tooth = 44; // should convert to 28

    //calc convert tooth to amer
    var i = 0;
    while (i < 33) {
    if ( tooth == int_teeth[i] ) { // compare tooth value to value in array

    Console.write(i);
    // calc new value as position i, amer value , change column value
    i += 1;
    }
    }
    return i;
    Any comment is appreciated.
    Thanks
    Joel

  2. marco

    17 Jul 2018 Administrator User since 2016

    @Joel_Eisenstat i+=1; must be outside the if block (it must be always incremented) otherwise it is an infinite loop

  3. Joel_Eisenstat

    17 Jul 2018 User since 2016

    Sorry , another dumb one ...

or Sign Up to reply!