> ## Documentation Index
> Fetch the complete documentation index at: https://developer.synopsys.com/llms.txt
> Use this file to discover all available pages before exploring further.

# PHXBoolean

## @PHXClassDecorator(PHXTException\_Decorator)

### class PHXBoolean(PHXSimpleType)

The ModelCenter type for booleans. This class adds the following features to the [`PHXSimpleType`](https://developer.synopsys.com/docs/modelcenter/modelcenter-scriptwrapper-api/2026-r1/python_scriptwrapper_api/PHXSimpleType):

* `value`: boolean
* `valueStr`: the source string for the value, useful for error checking when the value is NaN

#### `def __init__(self, varName)`

initializes value to false

* `@param varName`: the name of the variable already declared in the wrapper to reference
* `@type varName`: string
* `@rtype`: void

```python theme={null}
  varName = checkIsInstance(varName, str)
  self.mcName = varName
```

#### `def fromString(self, value)`

converts a String representation to the internal value

* `@param value`: the value to convert
* `@type value`: string
* `@rtype`: void

```python theme={null}
  value = checkIsInstance(value, str)

  boolVal = bool(value)
  phxPython.boolSetValue(self.mcName, boolVal)
```

#### `def getValue(self)`

retrieves the current value of the variable

* `@rtype`: boolean

```python theme={null}
  return phxPython.boolGetValue(self.mcName)
```

#### `def getValueStr(self)`

retrieves the current value of the variable (in string form)

* `@rtype`: string

```python theme={null}
  return fromString()
```

#### `def setValue(self, value)`

sets the value for the variable

* `@param value`: the value
* `@type value`: boolean
* `@rtype`: void

```python theme={null}
  value = checkIsInstance(value, bool)
  phxPython.boolSetValue(self.mcName, value)
```

#### `def toString(self)`

converts the variable to a string

* `@rtype`: string

```python theme={null}
  return str(bool(phxPython.boolToString(self.mcName)))
```
