0

Is there such a function in Delphi that will return the result of a comparison.

Example:

label.visible := evaluate(1 > 3);

I have searched but I don't know what that would be called.

6
  • 1 > 3 is a boolean operation, and the result of the comparison can be directly assigned to the Visible property. Label1.Visible := 1 > 3;. This isn't an actual question, as it doesn't make sense; there's no function needed. Commented May 3, 2013 at 22:03
  • @KenWhite To be precise, it is an expression rather than an operation Commented May 3, 2013 at 22:04
  • @David: Gee. Once again, you got me. What did I do to invoke the minor syntax police this week? That's two nitpicks (1 totally uncalled for and inaccurate) today from you. Commented May 3, 2013 at 22:07
  • @Chris: My mistake: It's a boolean expression. Commented May 3, 2013 at 22:09
  • @KenWhite Details are important and I'm not aware of any inaccuracies in my nitpicks. I'd like to be corrected if I got something wrong. Commented May 3, 2013 at 22:12

1 Answer 1

7

There is no need for a Function you can just write

label.visible := 1 > 3;

since 1 > 3 is a boolean expression.

Sign up to request clarification or add additional context in comments.

5 Comments

Thanks. I tried this and it errored out. Musta been a syntax error.
Ya. Label was just for this example.
@Chris, or, uhm, you might use the CompareValue function from Math unit, with which you'd write a code like this, but it's like cutting an apple with a chain saw.
@TLama +1 for they apple and chain saw analogy.
Working with nothing special is fine by me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.