Const assignment 
Author Message
 Const assignment

Is there a way in Pascal to assign a value to a Const only if a condition
exisit

For example:

FileName is a const

if(a) then

FileName = 'aaa'

else

FileName = 'bbb'



Fri, 21 Nov 2003 19:14:58 GMT  
 Const assignment
In borland pascal no, maybe in freepascal.

What you can do is create it as a variable then if this is in a unit
just add this to the end of the unit

begin
  if blah = aas then
  FileName:= 'aaa'
  else
   Filename:= 'xxx'
end.

remember that part of code will execute before the main program.

Quote:

> Is there a way in Pascal to assign a value to a Const only if a condition
> exisit

> For example:

> FileName is a const

> if(a) then

> FileName = 'aaa'

> else

> FileName = 'bbb'



Sat, 22 Nov 2003 04:05:34 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Const assignment

2. const instead of var for a local parameter

3. Leaving out fields in CONST initialisation

4. const instead of var for a local parameter

5. Const and arrays of records

6. CONST in ASM

7. "Exceeded line length" in Const

8. Big Const

9. Const parameter in procedures?

10. Global Const R00les Bigtimes

11. Read from Const in ASM?

12. Var.sized const arrays?

 

 
Powered by phpBB® Forum Software