-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
iteration.mon : wrong hash key/value #90
Comments
OK there is something going wrong here. So your first example is this:
That produces:
So the issue there seems to be that the first entry was skipped, and the second was duplicated. I'll take a look now. (The second example you post I think is the same. The first item is skipped, and the second is repeated.) |
This commit adds a test-case which checks that the iteration over hash keys returns the correct results. It seems that the value varies over runs - so repeating the test ten times is likely sufficient to trigger the issue. Once this bug is fixed this will close #90.
Seems that re-running this code again and again gives different results. Added a test-case in #91, and will resolve it there. |
When I execute iteration.mon, I got wrong :
Hash: key
Foo
Steve
Hash: key/value
Bar => Foo
Bar => Foo
When I rewrite script to:
_h = { "Foo": "Bar", "Steve": "Kemp", "Name": "Wade" }
puts( "Hash: key\n")
foreach key in h {
puts( "\t", key, "\n");
}
hh = { "Foo": "Bar", "Steve": "Kemp", "Name": "Wade" }
puts( "Hash: key/value\n")
foreach key,val in hh {
puts( "\t", key, "\t=>\t", val, "\n");
}_
I got:
Hash: key
Steve
Foo
Steve
Hash: key/value
Bar => Foo
Kemp => Steve
Wade => Name
The text was updated successfully, but these errors were encountered: