Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

for var, index in array #41

Open
iassasin opened this issue Jun 10, 2018 · 1 comment
Open

for var, index in array #41

iassasin opened this issue Jun 10, 2018 · 1 comment

Comments

@iassasin
Copy link
Owner

Рассмотреть вариант добавления конструкции итерирования по массиву одновременно с ключами. Варианты синтаксиса:

  • for (val, index) in array
  • for val, index in array
  • for val[index] in array
@maestroprog
Copy link
Collaborator

  • for index -> val in array
  • for index => val in array

В твиге тоже такой вариант:

  • for val, index in array

но там сначала указывается index а затем value:

  • for index, value in array
    думаю с такой порядок интуитивно понятен.
    val[index] это что-то странное =)
    ещё можно так
  • for index: val in array

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants