Repeating Blocks: Iteration 靜宜大學資管系 楊子青

Slides:



Advertisements
Similar presentations
Which TV program is the video? 中国达人秀 China’s Got Talent 选秀节目 talent show talent n. 天资;天赋.
Advertisements

护理学基础 第七章 医院与住院环境.
胸痛中心的时间流程管理 上海胸科医院 方唯一.
《互联网运营管理》系列课程 觉浅网 荣誉出品
Android App簡介及 App Inventor 2體驗 靜宜大學資管系 楊子青
专题八 书面表达.
Business English Reading
中职英语课程改革中 如何实践“以就业为导向,服务为宗旨”的办学理念
完形填空技巧 CET4.
第4章 VHDL设计初步.
How can we be a member of the Society? You should finish the following tasks if you want to be a member of the Birdwatching Society.
XI. Hilbert Huang Transform (HHT)
Module 5 Shopping 第2课时.
Ⅱ、从方框里选择合适的单词填空,使句子完整通顺。 [ size beef special large yet ]
敬拜的心 當音樂消失, 所有這些都挪去 我就是單單來, 只是為了帶來Something that's of worth,
Operating System Concepts 作業系統原理 Chapter 3 行程觀念 (Process Concept)
学练优英语教学课件 八年级(上) it! for Go
Do you want to watch a game show?
MIT App Inventor簡介及 「Hello World」程式初體驗 靜宜大學資管系 楊子青
樹狀結構 陳怡芬 2018/11/16 北一女中資訊專題研究.
行動商務與多媒體應用學系 詹啟祥 辦公室:HB35室 分機:
敬拜的真褅 The Heart of Worship Words and music by Matt Redman
Working with Databases (II) 靜宜大學資管系 楊子青
Chapter 3 行程觀念 (Process Concept)
C 語言簡介 - 2.
但是如果你把它发给最少两个朋友。。。你将会有3年的好运气!!!
羅亞方舟的啓示 Louis 2007.
Android App簡介及 App Inventor 2體驗 靜宜大學資管系 楊子青
9/26 今天的学习目标 (Today’s Learning Objectives)
錢買不到的禮物 自動換頁 音樂:海莉·衛斯頓 演唱<Nada Sousou> 日本電影「淚光閃閃」主題曲英文版
Hobbies II Objectives A. Greet a long time no see friend: Respond to the greeting: B. Ask the friend if he/she likes to on this weekend? She/he doesn’t.
App Inventor 2初體驗 靜宜大學資管系 楊子青
資料庫 靜宜大學資管系 楊子青.
Remember the five simple rules to be happy 快樂的五個簡單常規
My favorite subject is science.
Programming Your App’s Memory 靜宜大學資管系 楊子青
Unit 8 Our Clothes Topic1 What a nice coat! Section D 赤峰市翁牛特旗梧桐花中学 赵亚平.
Guide to a successful PowerPoint design – simple is best
在Microsoft Access 下 建立資料庫
Good Karma 善因緣 This is a nice reading, but short. Enjoy! This is what The Dalai Lama has to say for All it takes is a few seconds to read and think.
Good Karma 善業 原稿:牛Sir 配楽:懺悔經 捕頭恭製 按鍵換頁.
BORROWING SUBTRACTION WITHIN 20
Presentation 约翰316演示 John 3 : 16
林一平 講座教授 資訊學院院長 新竹國立交通大學
计算机问题求解 – 论题 算法方法 2016年11月28日.
软件测试技术-白盒测试 张志强 2006.
Unit 4 Body Language.
Good Karma 善因緣 This is a nice reading, but short. Enjoy! This is what The Dalai Lama has to say for All it takes is a few seconds to read and think.
取材 Tommy’s Window slideshow
Remember the five simple rules to be happy 快樂的五個簡單常規
Remember the five simple rules to be happy 快樂的五個簡單常規
冀教版 九年级  Look into Science!.
冀教版 九年级 Lesson 20: Say It in Five.
Remember the five simple rules to be happy 快樂的五個簡單常規
磁共振原理的临床应用.
M; Well, let me check again with Jane
Create and Use the Authorization Objects in ABAP
Good Karma 善因緣 This is a nice reading, but short. Enjoy! This is what The Dalai Lama has to say for All it takes is a few seconds to read and think.
反覆迴圈、陣列、副程式 靜宜大學資管系 楊子青
反覆迴圈、陣列、副程式 靜宜大學資管系 楊子青
怎樣把同一評估 給與在不同班級的學生 How to administer the Same assessment to students from Different classes and groups.
Programming Your App to Make Decisions: Conditional Blocks 靜宜大學資管系 楊子青
Hospitality English 酒店商务英语 讲师:罗云利 工商与公共管理学院.
Introduction to Computer Security and Cryptography
MATLAB 結構化財務程式之撰寫 MATLAB財務程式實作應用研習 主題五 資管所 陳竑廷
錢買不到的禮物 自動換頁 音樂:海莉·衛斯頓 演唱<Nada Sousou> 日本電影「淚光閃閃」主題曲英文版
Programming Your App to Make Decisions: Conditional Blocks 靜宜大學資管系 楊子青
陸綺紅 ( 陸明君 飾 ) 綽號紅豆 在一次危險中,阿奇奮不顧身的為她擋了一棍,擔心的將她緊緊抱著……
陳情表之外     with 三仁 三樂 歐陽宜璋製於 /10/23.
When using opening and closing presentation slides, use the masterbrand logo at the correct size and in the right position. This slide meets both needs.
Presentation transcript:

Repeating Blocks: Iteration 靜宜大學資管系 楊子青 2013.3.18.

Iteration One thing computers are good at is repeating operations. In this chapter, you’ll learn how to program repetition with just a few blocks instead of copying and pasting the same blocks over and over. repeat blocks can significantly simplify an app.

Two blocks for repeating operations The foreach block applies a set of functions to each element of a list. While is more general: you can use it to process a list. With while, the inner blocks are performed continuously while a certain condition is true. After the blocks within the while are executed, control loops back up and the test condition is tried again. Only when the test evaluates to false does the while block complete.

1. Foreach Exampe: Copying and pasting the blocks for each phone number to be texted

Foreach Repeating Functions on a List Using foreach This code can be read as: For each item (phone number) in the list phoneNumbers, set the Texting object’s phone number to the item and send out the text message.

A Second foreach Example: Displaying a List The simple way to display a list is to plug it directly into a label the list items are displayed in the label as a single row: (111–1111 222–2222 333–3333) we want a newline character: \n. “\n111–1111\n222–2222\n333–3333” would appear as:

Using the foreach block to process the list and put a newline character A closer Look At Looping:

練習:資管系實驗室列表App 延續上一章練習: 將實驗室顯示於Label (每筆資料跳行顯示) 讓使用者利用Textbox輸入資管系實驗室,將以下資料加入List變數,於ListPicker顯示結果 主顧403 電子商務實驗室 (403EC) 主顧405 企業資源規劃實驗室 (405ERP) 主顧407 醫療資訊系統實驗室 (407HIS) 主顧409 資料庫與資料探勘實驗室 (409DB) … 使用者如果在ListPicker選了一個實驗室,則將該實驗室資料刪除 將實驗室顯示於Label (每筆資料跳行顯示)

2. While The while block is a bit more complicated to use than foreach. foreach repeats over a list, but while can repeat while any arbitrary condition (任意條件) is true.

Using while to Compute a Formula 假設使用者輸入3: N Number total 3 1 2 4 6

Using while to Process Lists

練習:資管系實驗室列表App 利用While取代foreach,改寫本章練習