# 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hology.app/zh-tw/shaders/typescript-shaders/select.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
