Presentation is loading. Please wait.

Presentation is loading. Please wait.

New ways of learning week Sign up at: www.library.dmu.ac.uk/Home/Calendar Monday 25 th November Tuesday 26 th November Wednesday 27 th November Thursday.

Similar presentations


Presentation on theme: "New ways of learning week Sign up at: www.library.dmu.ac.uk/Home/Calendar Monday 25 th November Tuesday 26 th November Wednesday 27 th November Thursday."— Presentation transcript:

1 New ways of learning week Sign up at: www.library.dmu.ac.uk/Home/Calendar Monday 25 th November Tuesday 26 th November Wednesday 27 th November Thursday 28 th November Friday 29 th November Finding images using databases (11-12) Putting data into words in your dissertation (11-12) Visual approaches for effective learning (11-12) How to make Groupwork work (12-1) Using social media to raise your online profile (12-1) Mind over matter: use your imagination for study success (12-1) Electronic newspapers. Today and Yesterday. (12-1) Be more productive and manage your stress (12-1) Writing in science and technology (1-2) Thinking about your dissertation: writing the proposal (1-2) New ways of seeing: assignment planning, research and discovery (1-2:30) Taking a critical approach to your work (5:30-6:30) Writing in art and design (2:30-3:30)

2 Introduction to Repetition

3 Problem What do we do when we want to do something over and over again? E.g. Add the numbers 1 – 10 to a list box… lstTest.Items.Add(1) lstTest.Items.Add(2) lstTest.Items.Add(3) lstTest.Items.Add(4) lstTest.Items.Add(5) lstTest.Items.Add(6) lstTest.Items.Add(7) lstTest.Items.Add(8) lstTest.Items.Add(9) lstTest.Items.Add(10)

4 Solution Use a loop (repetition) Start of loop (set rules for number of repeats) Stuff we want to repeat End of Loop

5 Types of Loops Type 1For-Next Loop This loop repeats a section of code a specified number of times. So if we wanted to do a task 1000 times, this kind of loop is ideal. Type 2While Loop (Pre processing) This loop repeats a section of code until a certain condition is met, that is the condition may be met on the first attempt or on the thousandth, we simply don’t know! Type 3Do Loop (Post processing) Always runs the code once then continues until a certain condition is met.

6 To make loops work… For any loop to work we need to know three things… When the loop will start When the loop will end Where the loop is up to at a given point

7 Do While Loop Structure while (Condition) { //code to repeat goes here }

8 Things to Watch with Do While Loops! What is wrong with the following loops?

9 Indexes Counters and Accumulators Indexes

10 Indexes Counters and Accumulators Counters Answers the question “How Many?” How many loan payments?

11 Accumulators Answer the question “How much?” Indexes Counters and Accumulators


Download ppt "New ways of learning week Sign up at: www.library.dmu.ac.uk/Home/Calendar Monday 25 th November Tuesday 26 th November Wednesday 27 th November Thursday."

Similar presentations


Ads by Google