{"action":"created","issue":{"url":"https://api.github.com/repos/nightroman/PowerShellTraps/issues/5","labels_url":"https://api.github.com/repos/nightroman/PowerShellTraps/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/nightroman/PowerShellTraps/issues/5/comments","events_url":"https://api.github.com/repos/nightroman/PowerShellTraps/issues/5/events","html_url":"https://github.com/nightroman/PowerShellTraps/issues/5","id":83799980,"number":5,"title":"If-else blocks and array types","user":{"login":"SergeyTeplyakov","id":726448,"avatar_url":"https://avatars.githubusercontent.com/u/726448?v=3","gravatar_id":"","url":"https://api.github.com/users/SergeyTeplyakov","html_url":"https://github.com/SergeyTeplyakov","followers_url":"https://api.github.com/users/SergeyTeplyakov/followers","following_url":"https://api.github.com/users/SergeyTeplyakov/following{/other_user}","gists_url":"https://api.github.com/users/SergeyTeplyakov/gists{/gist_id}","starred_url":"https://api.github.com/users/SergeyTeplyakov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SergeyTeplyakov/subscriptions","organizations_url":"https://api.github.com/users/SergeyTeplyakov/orgs","repos_url":"https://api.github.com/users/SergeyTeplyakov/repos","events_url":"https://api.github.com/users/SergeyTeplyakov/events{/privacy}","received_events_url":"https://api.github.com/users/SergeyTeplyakov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-06-02T02:38:41Z","updated_at":"2015-06-02T06:13:08Z","closed_at":null,"body":"PowerShell drives me nuts (I hope I missing something here).\r\n\r\nConsider following code:\r\n\r\n```poweshell\r\n$var = $True\r\n\r\n$foo = if ($var) {@(, 1)}\r\n\r\n$foo # 1\r\n$foo.GetType().FullName #System.Int32\r\n\r\n$foo = @(, 1)\r\n\r\n$foo # 1\r\n$foo.GetTYpe().FullName #System.Object[]\r\n```\r\n\r\nClearly that behavior should be the same. Right? But not exactly. Here is an output:\r\n\r\n```\r\n1\r\nSystem.Int32\r\n1\r\nSystem.Object[]\r\n```\r\n\r\nI would say that this is a bug, not a trap!"},"comment":{"url":"https://api.github.com/repos/nightroman/PowerShellTraps/issues/comments/107822203","html_url":"https://github.com/nightroman/PowerShellTraps/issues/5#issuecomment-107822203","issue_url":"https://api.github.com/repos/nightroman/PowerShellTraps/issues/5","id":107822203,"user":{"login":"nightroman","id":927533,"avatar_url":"https://avatars.githubusercontent.com/u/927533?v=3","gravatar_id":"","url":"https://api.github.com/users/nightroman","html_url":"https://github.com/nightroman","followers_url":"https://api.github.com/users/nightroman/followers","following_url":"https://api.github.com/users/nightroman/following{/other_user}","gists_url":"https://api.github.com/users/nightroman/gists{/gist_id}","starred_url":"https://api.github.com/users/nightroman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nightroman/subscriptions","organizations_url":"https://api.github.com/users/nightroman/orgs","repos_url":"https://api.github.com/users/nightroman/repos","events_url":"https://api.github.com/users/nightroman/events{/privacy}","received_events_url":"https://api.github.com/users/nightroman/received_events","type":"User","site_admin":false},"created_at":"2015-06-02T06:13:08Z","updated_at":"2015-06-02T06:13:08Z","body":"And this is yet another reason why it's not good that a ternary operator is missing in PowerShell. `if` does not exactly replace it, as we can see."}}