| Top Previous Next |
|
There are plenty of things we can change. And then, there are many we can't. Let's talk about the second ones. Earth spins in ~24 hours - we can't change it. If you throw a rock, it'll fall to ground - there's no way around that. Engines need power to run - at least for now, we can't make 'em run without it. And computers ? They use constants all the time, although it looks like you can never catch their tail. Not only these silly machines can't work without constant power input (and constant voltage), but software part also enjoys using constant data values. And constant data values are not only letters and numbers - they are represented with certain labels, used as value descriptors. Like postcards have addresses of their recepients...
...constants in software are also labeled, making it easy to determine what kind of data is assigned to which constants.
Data put into constants is not meant to be directly changed by your program.
Let's say the glass on images above represents constant label (container). Water in glass is constant. It's not changing in time. Constants in MMB are used:
And guess what - some constants can be changed, but indirectly - if you change played audio or video file, it's expected to affect duration & title constants. But MMB performs changes to constants automatically - so you don't have to worry about 'em at all. Important feature of MMB's constants is ability to retrieve their values into string and numerical variables. This enables wide range of operations over retrieved info.
To copy constant info to numerical variable, you'll start by: a) writing label of numerical variable: CurrentYear b) followed by equal sign: = c) and writing constant you want info from: CBK_Year
All together, MMB code line for retrieving current year from CBK_Year constant to numerical variable CurrentYear looks like this: CurrentYear=CBK_Year
To copy constant info to string variable, you'll start by: a) writing label of string variable: WindowsVer$ b) followed by equal sign: = c) and writing constant you want info from: WinVer()
MMB code line for retrieving of Windows version from WinVer() constant to string variable WindowsVer$ looks like this: WindowsVer$=WinVer()
As visible from examples above, some constants return numerical values and some return string values (depends on info they contain).
|