# Booleans - True, False, or Default

**URL:** <https://forum.kirupa.com/t/booleans-true-false-or-default/303866>\
**Category:** flash\
**Created:** [January 28, 2010, 1:27pm UTC](https://forum.kirupa.com/t/booleans-true-false-or-default/303866 "2010-01-28T13:27:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![IQAndreas](https://avatars.discourse-cdn.com/v4/letter/i/f08c70/32.png) [@IQAndreas](https://forum.kirupa.com/u/IQAndreas)\
**Post date:** [January 28, 2010, 1:27pm UTC](https://forum.kirupa.com/t/booleans-true-false-or-default/303866/1 "2010-01-28T13:27:27Z")

</div>

I want a Boolean to have one one of three properties; true, false, or default.

**Otherwise I need code like this in the getter/setter:**

```auto
//WHAT I'M USING
private var _useTimestamp:Boolean;
private var _useTimestampDefault:Boolean;

public function get useTimestamp():Boolean
{
   if (_useTimeStampDefault)
      { return GlobalSettings.useTimestamp; }
   else
      { return _useTimestamp; }
}
public function set useTimestamp(value:Boolean)
{
   _useTimestampDefault = false;
   _useTimestamp = value;
}

public function get useTimestampDefault():Boolean
{
   return _useTimestampDefault;
}
public function set useTimestampDefault(value:Boolean)
{
   _useTimestampDefault = value;
}

```

This is what I want to do instead:

```auto
//What I want, A LOT less code
private var _useTimestamp:Boolean;

public function get useTimestamp():Boolean
{
   if (_useTimestamp == default)
      { return GlobalSettings.useTimestamp; }
   else
      { return _useTimestamp; }
}
public function set useTimestamp(value:Boolean)
{
   //Timestamp can be set to "true, false, or default/null"
   _useTimestamp = value;
}

```

Also, I want to use this feature as default values in properties

```auto
public function traceMe(str:String, useTimestamp:Boolean = GlobalSettings.useTimestamp)
{ ... }

```

But that throws the following error:  
_1047: Parameter initializer unknown or is not a compile-time constant._

I could create a new class that has one single property which handles boolean values, but that means that it is treated as an instance, and not as a real value, which means that statements like this might be off:  
_if (customBool) { … }_

**Is this possible?** If I set the boolean to null, it will default to false, and that is not what I want.
