Posts: 251
Threads: 22
Joined: Dec 2004
I know fb is not xb but while working with different languages you start to appreciate the little details, like:
IFZ val
=====> if the numeric val is ZERO (regarding strings = if lenght is ZERO...)
IFT val
=====> if the numeric val is TRUE
IFF val
=====> if the numeric val is FALSE
Is it possible to get these in the future?
Thanks
Posts: 658
Threads: 71
Joined: Sep 2003
you can implement these using macros.
url]http://fbide.sourceforge.net/[/url]
Posts: 1,272
Threads: 36
Joined: Feb 2003
Example:
Code:
#define IFZ(n) IF n = 0
#define IFT(n) IF n <> 0
#define IFF(n) IF n = 0
IFF (3 = 3) THEN
PRINT "If you can read this, your computer is on crack."
ELSE
PRINT "Congratulations! Your computer is sane!"
END IF
SLEEP
END
Posts: 251
Threads: 22
Joined: Dec 2004
Yes, doing it with macros is one way that works for me.
But if something so 'general' is used often, these macros need to be included almost every time.
Anyhow, thanks for pointing me to this possibility.
BTW
Personally I would use:
#define IFT(n) IF n = 1
because I always use ONE for TRUE :wink:
Posts: 73
Threads: 16
Joined: Jan 2005
Cute.
But I think QB/FB quite disagrees with your opinions about True/False 1/0
False is 0.
True is everything else.
False is the base definition.
Hence the not-equals 0.
Posts: 251
Threads: 22
Joined: Dec 2004
You got a point here, but for my defense I have to say that I would not qualify as a former qb user.
Because of this I can't say if your comment is correct or not. :wink:
In every language I used to code, TRUE was always a fixed value - in my case ONE. :wink:
On a sidenote:
If my memory is not deceiving me, some languages even have -1 as TRUE, this said, I always thought it's a fixed number and not - NOT ZERO :roll:
But I could be wrong ... :-?
--------------------------------
... it would not be the first time
--------------------------------
Take care
Posts: 1,774
Threads: 62
Joined: Aug 2003
I really just depends...
Code:
If Que = True Then Do_Something...
If Que Then Do_Something_Else..
The first one will execute only if Que is exactly equal to the value of True.
The second will execute anytime Que is <> 0.
That's how it works in QB anyway.
Posts: 1,439
Threads: 15
Joined: Apr 2003
I don't think these should be built in... it's a lot more readable to write 'if x = 0' than 'if ifz(x)' imho.
Posts: 489
Threads: 34
Joined: Jan 2005
that would be
if x=0
vs
ifz(x)
no need for the extra if.
ttp://m0n573r.afraid.org/
Quote:quote: "<+whtiger> you... you don't know which way the earth spins?" ... see... stupidity leads to reverence, reverence to shakiness, shakiness to... the dark side
...phear
Posts: 922
Threads: 15
Joined: Jun 2003
TRUE is -1 in QB/VB/FB, as there is no short-circuit evaluation.