[error] GenServer #PID<0.495.0> terminating
** (ArithmeticError) bad argument in arithmetic expression```
However, if I try the same code in `iex` it works and remove the last element without error
Any idea?
LostKobrakai already told you how to achieve your goal.
As to why you’re getting the error, it’s likely due to a parsing issue (can’t confirm at the moment): -1 is just a number (negative one). So this would probably work with your original code: List.delete_at(passed_params, length(passed_params) - 1) (note the spaces around the - operator).