Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
String Issues
#1
I'm having a weird issue. I have the following code setting a string:
Code:
IF currentMatchType=FACUP then let faCupMatchCountString="Round "+STR$(faCupMatchCount)
   IF faCupMatchCount=7 Then let faCupMatchCountString="Semi-Final"
   ELSEIF faCupMatchCount=8 Then let faCupMatchCountString="Final"
   END IF

Later on it prints that string. On a 1-6 it prints "Round 1" / "Round 2" and so on. As soon as the FaCupMatchCount hits 7 it prints gibberish and/or crashes...


Is there a potential issue in the string handling, or have I written more notoriously bad code?

The thing is, it works for the earlier numbers...
(yes, I can provide the whole program again if you wish... It's sometimes difficult to tell if I've done something amiss, or the compiler has - we've had array bounds checking issues already!)

If I change the code so both Ifs say "8" then it prints "Round 7" as expected, and then prints gibberish instead of "Final"

Here's the code that actually prints it at the point that it fails:
Code:
if currentMatchType=FACUP then print "F.A.Cup Match - ";faCupMatchCountString
    else PRINT "League Match - ";
       IF division=4 then print "League 2"
          elseif division=3 then print "League 1"
          elseif division=2 then print "Championship"
          else print "Premier League"
       END IF
    END IF

It prints "F.A. Cup Match - " and then gibberish on the screen.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)