hexagon logo

Check comment input for integer only

Hello,

I'm working on a 36pc setup with a counter and variable amount of pieces with origin point movements.
I've got a check in place to see if the number is outside of the numbers 1 through 36 but simply writing the letter "K" for example beats this entire check and the machine starts running..
So, in short, i'm trying to make the input fool proof.. Any way to check for numbers only?

Thanks!
Parents
  • C1 =COMMENT/INPUT,NO,FULL SCREEN=NO,
    Please give me an integer
    ASSIGN/V1=C1.INPUT
    ASSIGN/V2=V1/V1
    IF/V2<>1
    COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
    Please give an actual number next time
    END_IF/​
    


    Just assign the comment to a variable, divide it by itself and if they did not provide a number, they will get 0 instead of 1.

    If you need an integer you can assign V3=INT(V2)
Reply
  • C1 =COMMENT/INPUT,NO,FULL SCREEN=NO,
    Please give me an integer
    ASSIGN/V1=C1.INPUT
    ASSIGN/V2=V1/V1
    IF/V2<>1
    COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
    Please give an actual number next time
    END_IF/​
    


    Just assign the comment to a variable, divide it by itself and if they did not provide a number, they will get 0 instead of 1.

    If you need an integer you can assign V3=INT(V2)
Children
No Data