"foo"<> x = "foobar"(Elixir)
6091 단어 Elixir40대 돌출 엔지니어autoracex
소개
Elixir 즐기십니까



<>/2 의 재미있는 사용법을 소개합니다
"foo" <> x = "foobar"
iex> "foo" <> x = "foobar"
"foobar"
iex> x
"bar"
iex> "foo" <> x = "foobar"
"foobar"
iex> x
"bar"
<>/2 은 위와 같은 사용법을 할 수 있습니다

iex> "foo" <> "bar" = "foobar"
"foobar"
iex> "f" <> "o" <> "o" <> "bar" = "foobar"
"foobar






iex> x <> "bar" = "foobar"
** (ArgumentError) the left argument of <> operator inside a match should always be a literal binary because its size can't be verified. Got: x
(elixir 1.11.3) lib/kernel.ex:1857: Kernel.invalid_concat_left_argument_error/1
(elixir 1.11.3) lib/kernel.ex:1829: Kernel.wrap_concatenation/3
(elixir 1.11.3) lib/kernel.ex:1808: Kernel.extract_concatenations/2
(elixir 1.11.3) expanding macro: Kernel.<>/2
iex:10: (file)
Wrapping Up
패턴 매칭 , 안쪽이 깊네요



Reference
이 문제에 관하여("foo"<> x = "foobar"(Elixir)), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/torifukukaiou/items/d9ff24e4518cd89f15e1텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)