{"action":"created","issue":{"url":"https://api.github.com/repos/adafruit/DHT-sensor-library/issues/30","labels_url":"https://api.github.com/repos/adafruit/DHT-sensor-library/issues/30/labels{/name}","comments_url":"https://api.github.com/repos/adafruit/DHT-sensor-library/issues/30/comments","events_url":"https://api.github.com/repos/adafruit/DHT-sensor-library/issues/30/events","html_url":"https://github.com/adafruit/DHT-sensor-library/issues/30","id":57830850,"number":30,"title":"`return` from inside `switch`-`case`","user":{"login":"Mausy5043","id":9638943,"avatar_url":"https://avatars.githubusercontent.com/u/9638943?v=3","gravatar_id":"","url":"https://api.github.com/users/Mausy5043","html_url":"https://github.com/Mausy5043","followers_url":"https://api.github.com/users/Mausy5043/followers","following_url":"https://api.github.com/users/Mausy5043/following{/other_user}","gists_url":"https://api.github.com/users/Mausy5043/gists{/gist_id}","starred_url":"https://api.github.com/users/Mausy5043/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mausy5043/subscriptions","organizations_url":"https://api.github.com/users/Mausy5043/orgs","repos_url":"https://api.github.com/users/Mausy5043/repos","events_url":"https://api.github.com/users/Mausy5043/events{/privacy}","received_events_url":"https://api.github.com/users/Mausy5043/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-02-16T17:23:53Z","updated_at":"2015-04-05T09:00:28Z","closed_at":"2015-04-05T09:00:28Z","body":"I noticed in the functions `readTemperature()` and `readHumidity()` that the result is returned from inside the case using `return f;`. So in one switch-case construct there are multiple `return`s. One for each case.\r\n\r\nI was wondering if this is by design or not. I expected to see something like:\r\n```\r\nswitch {\r\n  case A:\r\n    f = foo;\r\n    break;\r\n  case B:\r\n    f = bar;\r\n    break;\r\n}\r\nreturn f;\r\n```\r\n\r\nIs there some advantage to choose the current construct over the other?\r\n"},"comment":{"url":"https://api.github.com/repos/adafruit/DHT-sensor-library/issues/comments/89736667","html_url":"https://github.com/adafruit/DHT-sensor-library/issues/30#issuecomment-89736667","issue_url":"https://api.github.com/repos/adafruit/DHT-sensor-library/issues/30","id":89736667,"user":{"login":"Mausy5043","id":9638943,"avatar_url":"https://avatars.githubusercontent.com/u/9638943?v=3","gravatar_id":"","url":"https://api.github.com/users/Mausy5043","html_url":"https://github.com/Mausy5043","followers_url":"https://api.github.com/users/Mausy5043/followers","following_url":"https://api.github.com/users/Mausy5043/following{/other_user}","gists_url":"https://api.github.com/users/Mausy5043/gists{/gist_id}","starred_url":"https://api.github.com/users/Mausy5043/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mausy5043/subscriptions","organizations_url":"https://api.github.com/users/Mausy5043/orgs","repos_url":"https://api.github.com/users/Mausy5043/repos","events_url":"https://api.github.com/users/Mausy5043/events{/privacy}","received_events_url":"https://api.github.com/users/Mausy5043/received_events","type":"User","site_admin":false},"created_at":"2015-04-05T09:00:28Z","updated_at":"2015-04-05T09:00:28Z","body":"PR #33 should resolve this issue. Closing."}}