Getting warning: variable “s6” is unused

A terrible but turning Good thing that I finally coming back to select Elixir again for my new project. :joy:
I had learned Elixir at 2016 and coded some Phoenix app and running non-stop for 3 more years, that is so amazing, thank you Elixir/Erlang/Phoenix folks!

When i started to upgrade my Phoenix 1.2/Elixir1.2 to current at yesterday I found an issue.

 33     s6 = List.to_string(l1)
 31     if is_all_lowercase6?(s6) do
 30         s6 = List.to_string(l2)
 29         if is_all_lowercase7?(s6) do
 28           s6 = murmur3_hash(str)
 27         end
 26     end
 25     # IO.inspect s6
 23     case has_key_in_redis(s6, str) do

This code gives me Warning:

warning: variable “s6” is unused (if the variable is not meant to be used, prefix it with an underscore)

I have some many this imperative style code in my code base, I am worry if they still working.
Any idea/help?


1 Like

Imperative assignment will not work anymore since 1.7 IIRC, best is to switch to 1.5 or 1.6 and fix all the warnings about the imperative assignment before switching to the more recent versions of elixir.

This of course might need you to partially rewrite your app depending on how much you used it…

1 Like

Previous discussion: How to assignment in the case condition?

1 Like