Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

Spot the error

Sign in to follow this  


Grr. I've been repeatedly putting the same error in my functions all day. I think I've fixed them all now but you never know. Can you spot the deliberate mistake?

// PRE: True
// POST: Returns List with identifier from user added
function User_bind_Identifier_to_value(List:TRecList):TRecList;
var ident : STRING;
var val:STRING;
Get_String_From_Prompt('Enter identifier name :',ident);
Get_String_From_Prompt('Enter identifier value :',val);
IF (val='TRUE') OR (val='FALSE') THEN
WRITELN('Error: not a boolean');
Sign in to follow this  


Recommended Comments

IF (val='TRUE') OR (val='FALSE') THEN

I've done that sort of thing before, really drives you up the wall trying to find it, and then drives you through the wall when you do find it, doesnt it?

Share this comment

Link to comment
That line works ok. The bug was when the user entered something other than TRUE or FALSE, it wouldn't return the tree so delphi crashes with some cryptic error.

The bad thing is this assignment is only worth 15% of the marks for the whole module (I take 8 modules a year) and I've been working on it for 4 days already! grrr...

Share this comment

Link to comment
ohh, i see why thats okay, i misinterepreted it as being a boolean expression and not user input.
but uh, you can have a value that isnt true or false?
a 'maybe' value? why? Or is it supposed to be true/false but the user can be annoying, as users often are, and put something like yes/no?

Share this comment

Link to comment
Yeah, its to stop users typing in something stupid as the value. It has to be TRUE or FALSE so it can be evaluated later on (using operators AND NAND OR and NOR). But its almost finished [smile], and then on to the other two assignments I've got to cram in. [dead]

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!