{"action":"created","issue":{"url":"https://api.github.com/repos/manastech/crystal/issues/1449","labels_url":"https://api.github.com/repos/manastech/crystal/issues/1449/labels{/name}","comments_url":"https://api.github.com/repos/manastech/crystal/issues/1449/comments","events_url":"https://api.github.com/repos/manastech/crystal/issues/1449/events","html_url":"https://github.com/manastech/crystal/issues/1449","id":106080034,"number":1449,"title":"Incorporate 'and' and 'or' logic operators as well.","user":{"login":"konsolebox","id":329497,"avatar_url":"https://avatars.githubusercontent.com/u/329497?v=3","gravatar_id":"","url":"https://api.github.com/users/konsolebox","html_url":"https://github.com/konsolebox","followers_url":"https://api.github.com/users/konsolebox/followers","following_url":"https://api.github.com/users/konsolebox/following{/other_user}","gists_url":"https://api.github.com/users/konsolebox/gists{/gist_id}","starred_url":"https://api.github.com/users/konsolebox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/konsolebox/subscriptions","organizations_url":"https://api.github.com/users/konsolebox/orgs","repos_url":"https://api.github.com/users/konsolebox/repos","events_url":"https://api.github.com/users/konsolebox/events{/privacy}","received_events_url":"https://api.github.com/users/konsolebox/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/manastech/crystal/labels/RFC","name":"RFC","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-09-11T19:39:55Z","updated_at":"2015-09-11T21:48:50Z","closed_at":null,"body":"Please consider adding `and` and `or` with the same precedence as Ruby`s (equal precedence).\r\n\r\nI prefer using them over `&&` and `||` as I find them more readable in the code and more consistent when having longer sequences.  `&&` having higher precedence than `||` to me adds confusion in which you are forced to use `()` to prevent the precedence effect.   `and` and `or` having equal precedence show clarity and is faster to write code with (because you don't have to think about precedence, only grouping when necessary).  `and` and `or` is also more appropriate for single-line reverse if or unless-like statements.   `and` and `or` is also good for creating logic chains where jumps happen.  Using &&` and `||` for that where you have to unnecessarily group is far from practical.\r\n\r\nAnyway, whatever one coder's preference is, I don`t think adding the operators would hurt as it has been part of Ruby.  There would also be unnecessary replace-and-verify work for converting Ruby code that uses them to Crystal code if those two operators don't exist.  IMO the language needs them to make itself essentially complete."},"comment":{"url":"https://api.github.com/repos/manastech/crystal/issues/comments/139669072","html_url":"https://github.com/manastech/crystal/issues/1449#issuecomment-139669072","issue_url":"https://api.github.com/repos/manastech/crystal/issues/1449","id":139669072,"user":{"login":"jhass","id":141294,"avatar_url":"https://avatars.githubusercontent.com/u/141294?v=3","gravatar_id":"","url":"https://api.github.com/users/jhass","html_url":"https://github.com/jhass","followers_url":"https://api.github.com/users/jhass/followers","following_url":"https://api.github.com/users/jhass/following{/other_user}","gists_url":"https://api.github.com/users/jhass/gists{/gist_id}","starred_url":"https://api.github.com/users/jhass/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhass/subscriptions","organizations_url":"https://api.github.com/users/jhass/orgs","repos_url":"https://api.github.com/users/jhass/repos","events_url":"https://api.github.com/users/jhass/events{/privacy}","received_events_url":"https://api.github.com/users/jhass/received_events","type":"User","site_admin":false},"created_at":"2015-09-11T21:48:50Z","updated_at":"2015-09-11T21:48:50Z","body":"You're still missing my point about natural language. \"if\", \"unless\", \"while\" and \"until\" are words that imply conditionally in natural speech, \"bring milk if you go to the grocery\", \"turn off the light unless it's dark\" and so on. \"and\" and \"or\" do not, \"go to the grocery and bring milk\", \"it's dark or turn off the light\" have a very different meaning or don't even make sense, there's no conditionally. Using `&&`/`||` for control flow is simply impractical due to their precedence rules, so you retain the conditionally by using them in conjunction with `if` etc."}}