How to check if . . .

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • TJ_Tigger
    Indigo Rose Customer
    • Sep 2002
    • 3159

    How to check if . . .

    . . . a number falls between two numbers? I am wanting to search for a line number in a file and check to see if that line number falls between two values. However, I am having a hard time figuring out the evaluation code. When I grab the line number I want to check and see if that line number falls between 1 and 13. I cant quite get the code right for it to work. Any suggestions on how to do this.

    IF (((%LineNumber% >=0) AND (%LineNumber% <=12)) OR ((%LineNumber% >=26) AND (%LineNumber% <=38)))
    IF (%LineNumber% = 0 or 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or 12 or 26 or 27 or 28...)

    I have tried the two above lines, the bottom one seems to work the best, but it is weird, when testing it will pull up line number 19 and the first IF statement (which does not include 19) still works. Very weird.
    TJ-Tigger
    "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
    "Draco dormiens nunquam titillandus."
    Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine
  • Derek
    Indigo Rose Customer
    • May 2001
    • 1254

    #2
    Re: How to check if . . .

    Your first line works for me. I tried it and it gave me no probs at all.
    Might there be some other code thats interfering with it somewhere?
    -
    = Derek
    ["All glory comes from daring to begin" - fortune cookie]

    Comment

    • TJ_Tigger
      Indigo Rose Customer
      • Sep 2002
      • 3159

      #3
      Re: How to check if . . .

      Could be. I was tired when I was working on it.
      TJ-Tigger
      "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
      "Draco dormiens nunquam titillandus."
      Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

      Comment

      • Lorne
        Indigo Rose Staff Member
        • Feb 2001
        • 2729

        #4
        Re: How to check if . . .

        Your second line isn't doing what you think. It ends up testing if %LineNumber% is 0, or if 1 is true, or if 2 is true, or if 3 is true, or if 4 is true...etc.

        It's the same as if you wrote this:

        IF ( (%LineNumber% = 0) or (1) or (2) or (3) or (4) or...)

        Since all those other numbers are true, the actions inside the IF are always going to be performed.
        --[[ Indigo Rose Software Developer ]]

        Comment

        Working...
        X