# What's wrong with my Phoenix LiveView code?

**URL:** <https://forum.devtalk.com/t/whats-wrong-with-my-phoenix-liveview-code/130914>\
**Category:** Backend Questions/Help\
**Tags:** elixir, liveview, phoenix\
**Created:** [3 November 2023 11:55 UTC](https://forum.devtalk.com/t/whats-wrong-with-my-phoenix-liveview-code/130914 "2023-11-03T11:55:29Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![zimt28](https://forum.devtalk.com/user_avatar/forum.devtalk.com/zimt28/32/5527_2.png) [@zimt28](https://forum.devtalk.com/u/zimt28)\
**Post date:** [3 November 2023 17:28 UTC](https://forum.devtalk.com/t/whats-wrong-with-my-phoenix-liveview-code/130914/3 "2023-11-03T17:28:55Z")

</div>

Your `guess` variable in the `handle_event` function is a string, so `guess == socket.assigns.random` is comparing a string against an integer. An easy fix would be to return a string from your `random/0` function.

---

_[View the full topic](https://forum.devtalk.com/t/whats-wrong-with-my-phoenix-liveview-code/130914)._
