---
title: "switch · RUAL Documentation"
description: "Returns a object based of the given expression."
canonical: https://docs.rual.nl/block-types/object/object_switch
language: en
---

# switch

This block is part of the [`object`](https://docs.rual.nl/block-types/object) group and was last modified in core [`v12.0.4`](https://docs.rual.nl/core-versions/120004).

Returns a object based of the given expression.

- expression required `value` The expression to evaluate.

- default `object` The default statement to be executed.

- output `object` Returns the object matching the expression.

- match `condition` Returns true in case a match was found.

Data selector: stringifies the expression value and compares it for exact STRING equality against each case pin's label; outputs the matching case's object with matched=true, else the default input with matched=FALSE (default never counts as a match). No match and no default yields object=nil. Only the winning input's pure-data chain is evaluated.

A typical wiring for [switch](https://docs.rual.nl/block-types/object/object_switch): the `object` out pin feeds [custom field](https://docs.rual.nl/block-types/object/object_get_custom_field).

![Studio canvas example for the switch block: typical wiring for switch.](https://docs.rual.nl/canvas-examples/object_switch.png)

### Version history

Introduced in [`v12.0.4`](https://docs.rual.nl/core-versions/120004).
