# r()

Smart version of return with an if condition as first argument

****

- Source: <https://github.com/getkirby/kirby/tree/5.5.3/config/helpers.php#L460>

****

```php
r(mixed $condition, mixed $value, mixed $alternative = null): mixed
```

## Parameters

| Name | Type | Default | Description |
| ---- | ---- | ---- | ---- |
| `$condition` (required) | `mixed` | – | – |
| `$value` (required) | `mixed` | – | The string to be returned if the condition is true |
| `$alternative` | `mixed` | `null` | An alternative string which should be returned when the condition is false |

## Return type

`mixed`

## Examples

The following example will print `odd`:

```php
<?php echo r((5 % 2 === 0), 'even', 'odd') ?>
```