elixir-koans icon indicating copy to clipboard operation
elixir-koans copied to clipboard

first..last pattern matching without step is deprecated

Open AidenDrake opened this issue 10 months ago • 0 comments

My VSCode extension shows a deprecation warning for the koan beginning:

  koan "I want the first and last in the range" do
    first..last = Range.new(1, 10)

in numbers.ex

This first..last syntax without a specified step was deprecated as of elixir 1.12 - https://hexdocs.pm/elixir/1.12/changelog.html#3-soft-deprecations-no-warnings-emitted

I think it should be changed to:

    first..last//_ = Range.new(1, 10)

but I'm still learning the language so I'm not sure!

This is a pretty small detail but the koans are meant to provide an idiomatic tour of the language. I think that should include showing how to use these statements in a non-deprecated style :)

AidenDrake avatar Dec 01 '24 17:12 AidenDrake