-
-
Save chrisza4/d3e089fd894fd77c2c5ae6c8dbf12106 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function prepare(isAdmin) { | |
| if (isAdmin) { | |
| // เฉพาะ Admin | |
| } else { | |
| // ทำอีกแบบหนึ่ง | |
| } | |
| } | |
| function process(isAdmin) { | |
| if (isAdmin) { | |
| // เฉพาะ Admin | |
| } else { | |
| // ทำอีกแบบ | |
| } | |
| } | |
| function cleanup () { | |
| // ส่วนใช้ร่วมกัน | |
| } | |
| // ส่วนหลัก (อ่านง่ายแล้ว) | |
| function main() { | |
| prepare(user.isAdmin()) | |
| while (...) { | |
| process(user.isAdmin()) | |
| cleanup() | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment