> For the complete documentation index, see [llms.txt](https://docs.hology.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hology.app/zh-tw/shaders/typescript-shaders/select.md).

# Select

In GLSL, you have both if statements and the ternary operator in order to be able to evaluate which of two expressions should be used. This can be achieved using the `select` function which works like a ternary operator.

```ts

const aboveZero: BooleanNode = attributes.position.y().gt(float(0))
const displacement: FloatNode = select(
    // condition
    aboveZero, 
    // if it is true
    pow(attributes.position.y(), 2), 
    // if it is false
    float(0) 
)

```

The condition must be of type `BooleanNode` and the values need to be of the same type.
