You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
❓ 질문
작성한 함수들을 뒤돌아보면 크게 2가지 모습을 띠고 있기에, 고민이 시작되었습니다.
1️⃣ 조건마다 바로 return
장점
단점
2️⃣ 마지막에 return
장점
단점
result
변수)를 굳이 선언해야 함각자 가지고 있는 장점이 뚜렷하고 케이스가 대비되기 때문에 '둘 중 어떤 방법을 사용해야 한다' 이전에 '상황에 따라 둘 다 사용하면 된다'는 담론 또한 가능합니다.
만약 둘 다 사용되는 방향으로 간다면 함수가 간단할 땐 1안, 복잡하거나 clean-up 처리가 필요할 땐 2안을 선택하도록 선택 가이드를 잡아두게 될 것 같습니다.
22 votes ·
Beta Was this translation helpful? Give feedback.
All reactions