Answering msg from James Goldbloom to rowan_crowe,
on Sunday March 17 1996 at 09:40
Hello James,
JG> Thanks, Rowan...
JG> I also wanted to know how to deal with...
JG> Const
JG> {$IFDEF GOLDBASE}
JG> I took the above to mean I'd first set up a variable, GOLDBASE (or
JG> whatever
JG> I wanted, but converting it over, I'd use the same anyway) and if it's
JG> value is 1 (true, a non-zero value) it would compile the next
JG> statements, and if zero it would compile in the upcoming statements
JG> between the $IFELSE and the $ENDIF.
That sounds pretty much correct.
JG> Converted, that would be (starting with the beginning of the code):
JG> -+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+---
JG> $DYNAMIC
JG> DEFINT A-Z
JG> GOLDBASE=1
JG> $IF GOLDBASE
JG> [staments related to goldbase here]
JG> $ELSE
JG> [statements not related to goldbase here]
JG> $ENDIF
JG> -+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--
JG> Now the above code does NOT work, because PB expects a constant to be
JG> used in place of the word GOLDBASE, and even if I set it to a value,
JG> it expects a number, such as "1" or higher, or of course 0 for the
JG> $ELSE.
JG> I am generally confused why I can't use GOLDBASE, with a predefined
JG> value. I guess I am saying I don't know why this does not work.
This is a fairly PB specific query, so I probably can't offer much help (I'm
a QB and VB/DOS man myself). Let me just fire up the demo version of PB I
have. :)
I don't see why you can't use a constant:
%GOLDBASE = 1 ' TRUE
'%GOLDBASE = 0 ' FALSE
$IF %GOLDBASE
print "True"
$ELSE
print "False"
$ENDIF
That works fine. You may have even sorted it out by now, since I haven't
replied immediately . . .
Cheers.
---
---------------
* Origin: Jelly-Bean software development, Melbourne AUST. (3:635/727.1)
|