Results 1 to 10 of 10

Thread: Ternary operator, begin/end

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    I don't.

    IIRC there's an Iff OVERLOADed function collection somewhere (sysutils?). If it isn't you can build it by your own.
    Code:
      FUNCTION Iff (CONST TheCondition: BOOLEAN; CONST Value1, Value2: REAL): REAL; OVERLOAD; INLINE;
      BEGIN
        IF TheCondition THEN RESULT := Value1 ELSE RESULT := Value2
      END;
    
      FUNCTION Iff (CONST TheCondition: BOOLEAN; CONST Value1, Value2: STRING): STRING; OVERLOAD; INLINE;
      BEGIN
        IF TheCondition THEN RESULT := Value1 ELSE RESULT := Value2
      END;
    Using VARIANT or generics would help too.

    Anyway I'm not friend of borrow stuff from other languages. I like and use Pascal and Object Pascal as they were. If you like C# or Ada stuff then use C# or Ada.
    Last edited by Ñuño Martínez; 17-05-2017 at 08:48 AM.
    No signature provided yet.

Bookmarks

Posting Permissions

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