生活中的 function 實例練習

模仿以下 Swift 定義和呼叫 function 的格式,從生活中的例子找靈感,在 Medium 發表創作, 寫愈多愈有趣愈好,比方寫作業,刷牙,搭訕女生,如何追到 Taylor Swift 都可以拆解成多個步驟,用 function 來定義。

條件: function 的 { } 內至少要包含三個指令。

func 買珍珠奶茶給女朋友喝() {   出門()   走到對面的飲料店()   跟店員點一杯去冰三分糖的珍珠奶茶()   付錢給店員()   走回家()   將飲料拿給女朋友()}買珍珠奶茶給女朋友喝()

學生作品

彼得潘的 Swift iOS App 開發教室

學習 Swift iOS App 開發的學生作品集

彼得潘的 iOS App Neverland

Written by

彼得潘的 Swift 程式設計入門,App程式設計入門作者,彼得潘的iOS App程式設計入門,文組生的iOS App程式設計入門講師,http://apppeterpan.strikingly.com

彼得潘的 Swift iOS App 開發教室

學習 Swift iOS App 開發的學生作品集

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade