PDA

View Full Version : bloody constraint errors



Cloud No.9
11-15-2005, 08:28 AM
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.

Necronopticous
11-15-2005, 10:32 AM
It this pseudocode or actual code?

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

Samuraid
11-15-2005, 10:33 AM
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... :p

Cloud No.9
11-15-2005, 05:52 PM
it's ada. and i kinda fixed it. still doesn't work but no more errors.

Dr Unne
11-15-2005, 11:19 PM
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.