How about a new type of constant that can be reassigned, beginning with two hash signs.
For axample you can define:
##x = 20
and later:
##x = #blah + 12
or even:
##x = ##x + 10
I often have to invent (long) constant names, that will only be used for the next few source lines anyhow..
Reassign ##Constant
Reassign ##Constant
Horst.
> it sortof defeats the object of calling it a constant then, doesnt it?
Agreed. A constant can NEVER be changed, once defined. Use a variable if
you need to change the value later. And take a look at this similar topic:
viewtopic.php?t=12571
Agreed. A constant can NEVER be changed, once defined. Use a variable if
you need to change the value later. And take a look at this similar topic:
viewtopic.php?t=12571
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
"PureBasic won't be object oriented, period" - Fred.
@moonshine
> Well it sortof defeats the object of calling it a constant then
Actually, a constant is, for example <b>123</b> in <b>size = 123</b> or "something" in <b>#word = "something"</b>.
A constant <b>object</b> is a compile-time variable that never changes. So, what I want, is a value assignment or a string assignment, that may change at compile time.
@PB
> Use a variable if you need to change the value later.
I want to keep it off run-time.
Which is no big deal: The A86 Assembler, for example has two different assignments:
name = value
name equ value
BTW: this reminds me of string concatenation:
Why do we need lots of runtime calls for this statement:
string$ = "something" + #crlf$ + "another" + chr(34) + "word" + chr(34)
@GPI
> Nice would be global and constants, which are only "active" in a file / included file...
Another concept of a compile-time reassignment.
But PB does not support modular environments...
> Well it sortof defeats the object of calling it a constant then
Actually, a constant is, for example <b>123</b> in <b>size = 123</b> or "something" in <b>#word = "something"</b>.
A constant <b>object</b> is a compile-time variable that never changes. So, what I want, is a value assignment or a string assignment, that may change at compile time.
@PB
> Use a variable if you need to change the value later.
I want to keep it off run-time.
Which is no big deal: The A86 Assembler, for example has two different assignments:
name = value
name equ value
BTW: this reminds me of string concatenation:
Why do we need lots of runtime calls for this statement:
string$ = "something" + #crlf$ + "another" + chr(34) + "word" + chr(34)
@GPI
> Nice would be global and constants, which are only "active" in a file / included file...
Another concept of a compile-time reassignment.
But PB does not support modular environments...
Horst.