So, I really new to elixir and starting to use resources on youtube etc.
Working through Live Learning Elixir part 1 @ around 90 minutes…
He adds this and, it compiles.
def convert_input_to_index(integer_input) do integer_input -1 end
On my machine, it does not. The guy is coming to elixir from ruby but I know, variables, lists etc are immutable right?
I get this error
$ iex "tic_tac_toe.exs" Erlang/OTP 22 [RELEASE CANDIDATE 2] [erts-10.3.1] [source-52dd4f4842] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [hipe] warning: variable "integer_input" is unused (if the variable is not meant to be used, prefix it with an underscore) tic_tac_toe.exs:25 ** (CompileError) tic_tac_toe.exs:26: undefined function integer_input/1 (elixir) src/elixir_locals.erl:108: :elixir_locals."-ensure_no_undefined_local/3-lc$^0/1-0-"/2 (elixir) src/elixir_locals.erl:109: anonymous fn/3 in :elixir_locals.ensure_no_undefined_local/3 tic_tac_toe.exs:3: (file)
I now underscore the 'variable _integer_input
Now I get a new error message
$ iex "tic_tac_toe.exs" Erlang/OTP 22 [RELEASE CANDIDATE 2] [erts-10.3.1] [source-52dd4f4842] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [hipe] ** (CompileError) tic_tac_toe.exs:26: "_integer_input -1" looks like a function call but there is a variable named "_integer_input", please use explicit parentheses or even spaces tic_tac_toe.exs:25: (module)
Now, is this just the fact he is using an older version and this way is depreciated? Or, is the variable -1 flawed from the start because I understood functional programming required making copies of lists etc and you couldn’t directly modify them as per ruby etc and OOP.
If this approach is wrong, i rather stop trying to fix it now TBH.