@pillaiindu
In your handle_event function, the comparison guess == socket.assigns.rand_num
is comparing a string (‘guess’) with an integer, which won’t work. The answer will be to convert guess to an int before making the comparison.
The simplest way to investigate the problem would have been to IO.inspect your guess and random number values before the comparison. That’s often a good first troubleshooting approach - sanity check what values you’re dealing with.
On your Q 2 - I agree that particular compiler message isn’t the most helpful, but with a bit of Elixir practise you’ll see it often enough to recognise in future. Here it just means the compiler doesn’t know about the message variable. You define it in the cond, so it doesn’t exist outside of that scope. The compiler tries to interpret it as a 0-arity function, which it can’t find. It would have the same problem with sort, but doesn’t get that far before erroring.
[btw - your 2nd question is the pattern to follow as in that one you are nicely specific about the error. That kind of context really helps someone trying to answer]
Not sure about another update (currently B8), but I’m pretty Sophie said the P1 (production release) of the book will be after we have LiveView hits 1.0, which will be in quite some time to be honest (which is understandable to be fair).
The book’s co-author has revealed that a new version of the book is almost there, and it will likely be available very shortly (possibily next week). This new version will also include coverage of Phoenix 1.7, which is fantastic news for anyone interested in learning about this technology!