Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Can you define a variable as a constant?

Author
Message
Bilboo
20
Years of Service
User Offline
Joined: 5th Dec 2003
Location:
Posted: 19th Jan 2004 01:56
Hi,

Sorry if the answer is obvious but can't find anything in the manual.

Thanks
andrew11
21
Years of Service
User Offline
Joined: 23rd Feb 2003
Location: United States
Posted: 19th Jan 2004 02:08
In Pro, use

#constant variablename value

The only draw back is that it replaces anything, not just values, such as:

#constant image sound
Make image from memblock 1,1

Will produce:

Make sound from memblock 1,1

You could just use global vars

Global varname = value

"All programmers are playwrites and all computers are lousy actors" -Anon
Bilboo
20
Years of Service
User Offline
Joined: 5th Dec 2003
Location:
Posted: 19th Jan 2004 02:15
Thanks for getting back so quickly, and for the advice.
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 19th Jan 2004 03:50
may wanna more strongly type your variables.
Instead of Global varname = value, use Global varname as (integer,string,float,etc) = value. So for an integer you'd say:

global intVarName as integer = 100 (or whatever value)

-RUST-

andrew11
21
Years of Service
User Offline
Joined: 23rd Feb 2003
Location: United States
Posted: 19th Jan 2004 05:04
I usually use $ and # after the variable so I know what type it is. I guess its a matter of preference.

"All programmers are playwrites and all computers are lousy actors" -Anon

Login to post a reply

Server time is: 2024-11-26 01:53:42
Your offset time is: 2024-11-26 01:53:42