# Creating an instance of enum{}

**URL:** <https://ziggit.dev/t/creating-an-instance-of-enum/5680>\
**Category:** Challenge\
**Tags:** language\
**Created:** [August 18, 2024, 8:02pm UTC](https://ziggit.dev/t/creating-an-instance-of-enum/5680 "2024-08-18T20:02:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chung-leong](https://ziggit.dev/user_avatar/ziggit.dev/chung-leong/32/999_2.png) [@chung-leong](https://ziggit.dev/u/chung-leong)\
**Post date:** [August 18, 2024, 8:02pm UTC](https://ziggit.dev/t/creating-an-instance-of-enum/5680/1 "2024-08-18T20:02:22Z")

</div>

How do you make the following function compile?

```zig
fn hello() enum {} {
    // ???
}

```

---

<div class="post-metadata">

**Author:** ![AndrewCodeDev](https://ziggit.dev/letter_avatar_proxy/v4/letter/a/278dde/32.png) [@AndrewCodeDev](https://ziggit.dev/u/AndrewCodeDev)\
**Post date:** [August 18, 2024, 8:52pm UTC](https://ziggit.dev/t/creating-an-instance-of-enum/5680/2 "2024-08-18T20:52:05Z")

</div>

En Garde!

```zig
fn hello() enum {} {
    const T = @typeInfo(@TypeOf(hello)).Fn.return_type.?;
    const t: T = undefined;
    return t;
}

pub fn main() !void {
    _ = hello();
}

```

Or, even simpler!

```zig
fn hello() enum {} {
    return undefined;
}

pub fn main() !void {
    _ = hello();
}

```

---

<div class="post-metadata">

**Author:** ![dimdin](https://ziggit.dev/user_avatar/ziggit.dev/dimdin/32/1457_2.png) [@dimdin](https://ziggit.dev/u/dimdin)\
**Post date:** [August 18, 2024, 9:01pm UTC](https://ziggit.dev/t/creating-an-instance-of-enum/5680/3 "2024-08-18T21:01:15Z")

</div>

You can fill `// ???` with anything that does not return, such as panic.

```zig
fn hello() enum {} {
    unreachable;
}

test {
    _ = hello();
}

```
