Article Preview
Buy Now
FEATURE
Encapsulating Booleans
Avoid reading out booleans before having them set
Issue: 11.2 (March/April 2013)
Author: Jens Bendig
Author Bio: When he was young Jens Bendig was fascinated by three things
Article Description: No description available.
Article Length (in bytes): 9,908
Starting Page Number: 26
Article Number: 12105
Resource File(s):
12105 project.zip Updated: 2013-03-04 13:33:24
Related Link(s): None
Excerpt of article text...
All properties have a type. And all properties can lie—by having a wrong value.
But booleans are the most deceiving among them! They are the hardest cases
because they only can have two values. That's a surprising statement, but I'll explain in detail why boolean properties can become a bigger problem than integers, floats, or strings... in terms of leading to complicated code.All Properties Have a Default Value
With Real Studio, the developer gives every property a default value just by declaring it. Either you give it a value with the declaration, or you just don't give any value, and then the compiler will give the property a default value, depending on the type of the property.
- Integers get the default value of
0
.
...End of Excerpt. Please purchase the magazine to read the full article.