{"action":"created","issue":{"url":"https://api.github.com/repos/manastech/crystal/issues/549","labels_url":"https://api.github.com/repos/manastech/crystal/issues/549/labels{/name}","comments_url":"https://api.github.com/repos/manastech/crystal/issues/549/comments","events_url":"https://api.github.com/repos/manastech/crystal/issues/549/events","html_url":"https://github.com/manastech/crystal/issues/549","id":69053326,"number":549,"title":"Strange behavior of the \"while\" expression","user":{"login":"ssvb","id":78642,"avatar_url":"https://avatars.githubusercontent.com/u/78642?v=3","gravatar_id":"","url":"https://api.github.com/users/ssvb","html_url":"https://github.com/ssvb","followers_url":"https://api.github.com/users/ssvb/followers","following_url":"https://api.github.com/users/ssvb/following{/other_user}","gists_url":"https://api.github.com/users/ssvb/gists{/gist_id}","starred_url":"https://api.github.com/users/ssvb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ssvb/subscriptions","organizations_url":"https://api.github.com/users/ssvb/orgs","repos_url":"https://api.github.com/users/ssvb/repos","events_url":"https://api.github.com/users/ssvb/events{/privacy}","received_events_url":"https://api.github.com/users/ssvb/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2015-04-17T03:16:13Z","updated_at":"2015-08-05T21:10:47Z","closed_at":null,"body":"Executing the following snippet as Crystal code differs from Ruby:\r\n```\r\n   # Trying to implement https://code.google.com/codejam/contest/544101/dashboard\r\n\r\n   original = [\r\n     \"BB.\",\r\n     \"RBR\",\r\n     \"RBR\",\r\n   ]\r\n\r\n   transformed = original.map {|l|\r\n     new_l = l.chars.select {|ch| ch != '.' }\r\n #    if new_l.size < l.size\r\n      new_l = ['.'] + new_l while new_l.size < l.size\r\n #    end\r\n     new_l\r\n   }\r\n\r\n   transformed.each {|l| p l.join }\r\n```\r\n\r\nRuby result (correct):\r\n```\r\n\".BB\"\r\n\"RBR\"\r\n\"RBR\"\r\n```\r\n\r\nCrystal result (incorrect):\r\n```\r\n\".BB\"\r\n\".RBR\"\r\n\".RBR\"\r\n```\r\n\r\nReproducible with both Crystal 0.6.1 and the current git."},"comment":{"url":"https://api.github.com/repos/manastech/crystal/issues/comments/128149920","html_url":"https://github.com/manastech/crystal/issues/549#issuecomment-128149920","issue_url":"https://api.github.com/repos/manastech/crystal/issues/549","id":128149920,"user":{"login":"ozra","id":563674,"avatar_url":"https://avatars.githubusercontent.com/u/563674?v=3","gravatar_id":"","url":"https://api.github.com/users/ozra","html_url":"https://github.com/ozra","followers_url":"https://api.github.com/users/ozra/followers","following_url":"https://api.github.com/users/ozra/following{/other_user}","gists_url":"https://api.github.com/users/ozra/gists{/gist_id}","starred_url":"https://api.github.com/users/ozra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ozra/subscriptions","organizations_url":"https://api.github.com/users/ozra/orgs","repos_url":"https://api.github.com/users/ozra/repos","events_url":"https://api.github.com/users/ozra/events{/privacy}","received_events_url":"https://api.github.com/users/ozra/received_events","type":"User","site_admin":false},"created_at":"2015-08-05T21:10:47Z","updated_at":"2015-08-05T21:10:47Z","body":"Regarding the multiline variant - +1, ditch it! Using break instead.\r\nRegarding the one liner: changing the operation from \"run once\" to the prefix-variant - \"run zero\" is _very surprising_ to _a lot_ of coders from different languages. I vote ditch both suffix variants of `while`! I know some langs that has already taken this route, and I haven't missed them there.\r\n"}}