{"action":"created","issue":{"url":"https://api.github.com/repos/airbnb/javascript/issues/325","labels_url":"https://api.github.com/repos/airbnb/javascript/issues/325/labels{/name}","comments_url":"https://api.github.com/repos/airbnb/javascript/issues/325/comments","events_url":"https://api.github.com/repos/airbnb/javascript/issues/325/events","html_url":"https://github.com/airbnb/javascript/issues/325","id":71124762,"number":325,"title":"Suggestion for if else comments","user":{"login":"VictorChen","id":1408813,"avatar_url":"https://avatars.githubusercontent.com/u/1408813?v=3","gravatar_id":"","url":"https://api.github.com/users/VictorChen","html_url":"https://github.com/VictorChen","followers_url":"https://api.github.com/users/VictorChen/followers","following_url":"https://api.github.com/users/VictorChen/following{/other_user}","gists_url":"https://api.github.com/users/VictorChen/gists{/gist_id}","starred_url":"https://api.github.com/users/VictorChen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VictorChen/subscriptions","organizations_url":"https://api.github.com/users/VictorChen/orgs","repos_url":"https://api.github.com/users/VictorChen/repos","events_url":"https://api.github.com/users/VictorChen/events{/privacy}","received_events_url":"https://api.github.com/users/VictorChen/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-04-26T21:47:22Z","updated_at":"2015-04-27T09:51:03Z","closed_at":null,"body":"Is there a perference for adding comments in the `else` block of an `if` statement ?\r\n\r\nFor example:\r\n\r\nCase 1:\r\n\r\n```js\r\n// comment about the if block\r\nif (condition) {\r\n  // comment about doStuff()\r\n  doStuff();\r\n} else {  // comment about the else block, what if this is too long ?\r\n  // comment about doOtherStuff();\r\n  doOtherStuff();\r\n}\r\n```\r\n\r\nCase 2:\r\n\r\n```js\r\n// comment about the if block\r\nif (condition) {\r\n  // comment about doStuff()\r\n  doStuff();\r\n} else { \r\n  // comment about the else block\r\n\r\n  // comment about doOtherStuff();\r\n  doOtherStuff();\r\n}\r\n```\r\n\r\nCase 3:\r\n\r\n```js\r\n// comment about the if block\r\nif (condition) {\r\n  // comment about doStuff()\r\n  doStuff();\r\n\r\n  // comment about the else block\r\n} else {\r\n  // comment about doOtherStuff();\r\n  doOtherStuff();\r\n}\r\n```\r\n\r\nNot sure if any of these is preferred... is there another way?"},"comment":{"url":"https://api.github.com/repos/airbnb/javascript/issues/comments/96587525","html_url":"https://github.com/airbnb/javascript/issues/325#issuecomment-96587525","issue_url":"https://api.github.com/repos/airbnb/javascript/issues/325","id":96587525,"user":{"login":"nkbt","id":175264,"avatar_url":"https://avatars.githubusercontent.com/u/175264?v=3","gravatar_id":"","url":"https://api.github.com/users/nkbt","html_url":"https://github.com/nkbt","followers_url":"https://api.github.com/users/nkbt/followers","following_url":"https://api.github.com/users/nkbt/following{/other_user}","gists_url":"https://api.github.com/users/nkbt/gists{/gist_id}","starred_url":"https://api.github.com/users/nkbt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nkbt/subscriptions","organizations_url":"https://api.github.com/users/nkbt/orgs","repos_url":"https://api.github.com/users/nkbt/repos","events_url":"https://api.github.com/users/nkbt/events{/privacy}","received_events_url":"https://api.github.com/users/nkbt/received_events","type":"User","site_admin":false},"created_at":"2015-04-27T09:51:03Z","updated_at":"2015-04-27T09:51:03Z","body":"I'd say - if you need to comment `else` case, then something is going wrong. More, if you need to comment something inside your function, then something is going wrong. That is a clear indication to split it and do some refactoring.\r\nFor almost all cases properly written JSDoc is more then enough."}}