-
Notifications
You must be signed in to change notification settings - Fork 16
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_EACH for many parameters #301
Conversation
@@ -23,3 +23,23 @@ FOR-EACH i IN ['a', 'b'] BEGIN | |||
SHOW $i+'/'+$j | |||
END | |||
END | |||
|
|||
FOR-EACH [i, j] IN [['a', 'b'], ['c', 'd']] BEGIN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ([i, j]
) looks like creation of array with 2 elements. It would be simpler by using just FOR i, j IN
. Why did you use 2 dimensional array in second part of statement? In this contex it is hard to tell what would be assigned to i
and j
. Cannot you just stay with flat, one dimensional array? In my opinion syntax like FOR i, j IN ['a', 'b', 'c', 'd']
would be simpler, and better. Users can take advantage of multiline array definitione to organize the data legibly. For example:
DEFINE users [
# user's email name password
'user@email', 'name', 'p@$$word',
'user2@email', 'name2', 'p@$$word',
'user3@email', 'name3', 'p@$$word',
'usern@email', 'namen', 'p@$$word']
FOR-EACH email, name, password IN $users BEGIN
...
END
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one-liner is only an example, you can write it in other ways:
FOR-EACH [i, j]
IN [
['a', 'b'],
['c', 'd']
]
BEGIN
or
DEFINE tabs [
['a', 'b'],
['c', 'd']
]
FOR-EACH [i, j]
IN $tabs
BEGIN
now is more readable
No description provided.