Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

IIF() function in Pascal

476 views
Skip to first unread message

Shloma Baum

unread,
Jul 21, 2002, 9:57:04 PM7/21/02
to
Hi

Is there an equivalent function in Object Pascal to the vb IIF()
function?

Thanks
Shloma


Rudy Velthuis (TeamB)

unread,
Jul 22, 2002, 8:03:45 AM7/22/02
to
In article <3d3b666e$1_2@dnews>, Shloma Baum says...

> Hi
>
> Is there an equivalent function in Object Pascal to the vb IIF()
> function?

Forget my previous message. The name is IfThen, and they are in Math and
StrUtils.
--
Rudy Velthuis (TeamB)

"If we knew what it was we were doing, it would not be called research,
would it?" -- Albert Einstein

Rudy Velthuis (TeamB)

unread,
Jul 22, 2002, 8:01:34 AM7/22/02
to
In article <3d3b666e$1_2@dnews>, Shloma Baum says...

> Hi


>
> Is there an equivalent function in Object Pascal to the vb IIF()
> function?

There are a few overloaded functions called IfElse in either SysUtils or
Math that do AFAIK the same.

Andrew Skinner

unread,
Jul 24, 2002, 4:25:08 AM7/24/02
to
I know this is awfully ignorant, and I've wanted to know for ages, but
what does IIF() do? and XOR? In plain english if possible <G>.

Andrew

Bas Gooijen

unread,
Jul 24, 2002, 7:04:57 AM7/24/02
to
iif is something like this:

it's a funtion you supply 3 parameters,
parameter 2 and 3 and the result type are the same type
(boolean,integer,string,...), parameter 1 is boolean.

if parameter 1 is true, the funtion returns parameter 2, else it returns
parameter 3

--

Bas Gooijen


"Andrew Skinner" <ski...@summerfld.demon.co.uk> wrote in message
news:3D3E6464...@summerfld.demon.co.uk...

Lucas Bantner (Borland)

unread,
Jul 24, 2002, 11:47:59 AM7/24/02
to
Andrew,
Bas already answered the IIF() question, so here goes for XOR.
XOR stands for exclusive OR. Basically, it means "either or, but not both."
For example, given this expression

boolC := boolA XOR boolB;

then boolC would evaluate to true if boolA is true or if boolB is true, but
not if both of them are true. And, naturally, it will evaluate to false if
both boolA and boolB are false.

--
Lucas
Delphi Developer Support
Borland

"Andrew Skinner" <ski...@summerfld.demon.co.uk> wrote in message
news:3D3E6464...@summerfld.demon.co.uk...

Bas Gooijen

unread,
Jul 24, 2002, 1:59:48 PM7/24/02
to

"Lucas Bantner (Borland)" <lban...@borland.com> wrote in message
news:3d3ecbda$1_2@dnews...
> Andrew,
>

indeed, in code it is like this:

boolA XOR boolB ==> (boolA OR boolB) and not (boolA and boolB )

(a or b but not a and b)

--

Bas Gooijen


Andrew Skinner

unread,
Jul 26, 2002, 4:00:07 AM7/26/02
to
I can seethat iif might be useful, but I'm stuck as to how one might use
XOR in real life. I suppose its my lack of maths education.

Andrew

Michael Simons

unread,
Jul 26, 2002, 9:42:26 AM7/26/02
to

"Andrew Skinner" <ski...@summerfld.demon.co.uk> wrote in message
news:3D410187...@summerfld.demon.co.uk...

> I can seethat iif might be useful, but I'm stuck as to how one might use
> XOR in real life. I suppose its my lack of maths education.

Actually XOR in math is how most people use OR in real life. For example,
go to a restaurant and order a steak. The waitress will ask you whether you
want a baked potato OR steamed vegetables OR some other side dish. Its
implied that you can only make one choice, not all of the above. In math,
all of the above is valid with OR, however this is not generally the case
with everyday "OR" and mathematical XOR.


--
Michael Simons
Software Programmer
Steven J. Baum P.C.
msi...@mbaum.com


0 new messages