Results 1 to 5 of 5

Thread: bloody constraint errors

  1. #1
    Banned
    Join Date
    Jan 2002
    Location
    scotland
    Posts
    1,938

    Default bloody constraint errors

    can anyone see why this bit of code would cause a constraint error?

    while Index <=6 loop
    while Drawn(Index) = Drawn(Check) loop
    Drawn(check) :=Random_Int(49);
    end loop;
    Check:=Check+1;
    if Check > 6 then
    Index:=Index+1;
    Check := Index+1;
    end if;
    end loop;

    it is meant to make sure that the drawn(index) numbers don't repeat. index starts at 1 and check starts at 2.

  2. #2

    Default

    It this pseudocode or actual code?

    If it's actual code, what language is it?

  3. #3
    Ominous Wanderer Tech Admin Samuraid's Avatar
    Join Date
    Oct 2001
    Posts
    5,522

    Default

    Is that pseudocode?

    If not, you may want to check case on your variables. Also, is " while Drawn(Index) = Drawn(Check) loop" correct or should it be == instead?

    EDIT: Talk about timing...

  4. #4
    Banned
    Join Date
    Jan 2002
    Location
    scotland
    Posts
    1,938

    Default

    it's ada. and i kinda fixed it. still doesn't work but no more errors.

  5. #5
    ORANGE Dr Unne's Avatar
    Join Date
    Dec 1999
    Posts
    7,394
    Articles
    1
    Contributions
    • Former Administrator
    • Former Developer
    • Former Tech Admin

    Default

    Array bounds error? Does Ada start counting array indices at 0 or 1? That's a common mistake no matter what language you use.

    Hard to debug this without knowing Ada and knowing what the Drawn function is doing, etc.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •