반응형
Notice
Recent Posts
Recent Comments
Link
목록OOP (1)
코딩일상
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/uPB11/btrQaJ83vBg/NIVhrye9Cb5HpM2MOALKB0/img.png)
절차지향 프로그래밍 { type CoffeeCup = { shots: number; hasMilk: boolean; }; const BEANS_GRAMM_PER_SHOT: number = 7; let coffeeBeans: number = 0; function makeCoffee(shots: number): CoffeeCup { if (coffeeBeans < shots * BEANS_GRAMM_PER_SHOT) { throw new Error("Not enough coffee beans!"); } coffeeBeans -= shots * BEANS_GRAMM_PER_SHOT; return { shots: shots, hasMilk: false, }; } coffeeBeans = 3 * BEANS_GRA..
기록/TIL(Today I Learned)
2022. 11. 2. 14:03