Special

Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 21 in printed book and digital formats -- plus a one-year subscription (beginning with 22.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview


Buy Now

Issue 11.2 ('Boolean')
Instant purchase and download via GumRoad!

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):

Download Icon 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.