Lesson 8: Creating Functions with Parameters

Slides:



Advertisements
Similar presentations
Alice Methods and Classes. Methods and Classes Methods – Coordinated sequence of instructions carried out when requested (e.g. move, turn to, etc.) Class.
Advertisements

How do we use place value in our number system? What is place value?
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 Adding Parameters to Commands ADO.NET - Lesson 06  Training time: 15 minutes.
Advanced Computer Science Lesson 4: Reviewing Loops and Arrays Reading User Input.
Getting started with the turtle Find the latest version of this document at
Effective Communication In Projects and Anywhere.
Process Writing. Rationale for process writing It’s wrong for teachers to dictate to students what they write. Writing should match students’ needs and.
Start the Quiz Show the answer Check the answer Time’s up! Timer
Computer Science 1000 LOGO II. Boolean Expressions like Excel and Scratch, LOGO supports three Boolean operators less than (
JavaScript: API’s, Parameters and Creating Functions with Parameters
Advanced Data Structures Lecture 1
‘Choose to be a well being’
Positive Solutions for Families
Happy Homecoming Mountain View!
Lesson Objectives Aims
AP CSP: Data Assumptions & Good and Bad Data Visualizations
‘Choose to be a well being’
APIs and Function Parameters
Unit 3 Lesson 4 & 5- Programming With Simple Commands / Creating Functions Day 26.
Creating Functions with Parameters
Agenda Warmup Finish 2.4 Assignments
UNIT 3 – LESSON 5 Creating Functions.
Plan for today Refactoring and Design Patterns
APIs and Function Parameters
Looping and Random Numbers
Learning Pit Strategies
In the front of your exercise book...
Lesson 9: "if-else-if" and Conditional Logic
CMPE212 – Stuff… Assn 2 due next Friday. Winter 2018
Learning to program with Logo
Today Is S.T.E.M. Day.
Subroutines Idea: useful code can be saved and re-used, with different data values Example: Our function to find the largest element of an array might.
Graph Paper Programming
Lesson 4: Controlling Memory with Variables
CS320n –Visual Programming
Day 4- Number Systems & Binary Numbers
Day 4- Number Systems & Binary Numbers
Graph Paper Programming
Lesson 16: Functions with Return Values
Please Bring a Composition Notebook to School Monday.
Log onto a computer first then ….
Introduction to Systems of Equations (and Solving by Graphing)
LESSON 13 – INTRO TO ARRAYS
CISC101 Reminders Assn 3 due Friday, this week. Quiz 3 next week.
Fall 2018 CISC124 12/1/2018 CISC124 Note that the next assignment, on encapsulation, is due next Wednesday at 7pm – not Friday. The next Quiz is not until.
Creating Functions with Parameters
HAPPY NEW YEAR! Lesson 7: If-statements unplugged
reminders Get your Springboard book! We will need it today!
Looping and Random Numbers
Unit 3: Lesson 9-Looping and Random Numbers
Unit 3: Lesson 6 & 7- Functions and Top-Down Design / APIs and Function Parameters Day 27.
CSCE 489- Problem Solving Programming Strategies Spring 2018
Computational Thinking for KS3
Day 4- Number Systems & Binary Numbers
Dimensional Analysis Practice
Overcoming Obstacles March 8, 2017 Kindness – Part 2.
Review- Quiz – Unit 2 Lesson 7
Lesson What are the connections? Lesson Objective:
Put it all together Lesson 5.
IPC144 Introduction to Programming Using C Week 4 – Lesson 2
Put it all together Lesson 6.
Announcements How to save your work? Quiz solution 5/5/2019
Unit 1, Lesson 6: Lab Equipment
Advisory Lesson Westport Middle School
Monday, October 30th Fill in your agenda with:
C1 Topic 1 – The Earth’s Atmosphere
U3L8 Creating Functions with Parameters
Reflection week beginning 6th March
Date: Science Notebooks due 9/29-human body model
Do Now What are the pros and cons of using a case study as a means to gather information for describing behavior.
Presentation transcript:

Lesson 8: Creating Functions with Parameters Day 28 Happy Halloween

Finish Lesson 7 Finish Lesson 7 From Friday

Lesson 8- Objectives Today Write functions with parameters to generalize a solution instead of duplicating code. Identify appropriate situations for creating a function with parameters. Use random numbers as inputs to function calls for the purpose of testing.

Lesson 8- Objectives Today Add parameters to a function in an existing piece of code to generalize its behavior.

Lesson 8 Writing functions with parameters can generalize solutions to problems even further. Especially in situations where feel like you are about to duplicate some code with only a few changes to some numbers, that is a good time to write a function that accepts parameters.

Lesson 8 The basic idea is that you often want to write a function that takes some input and performs some action based on that input For example, the turtle function moveForward is much more useful when you can specify how much to move forward (e.g., moveForward(100)), rather than just a fixed amount every time.

Lesson 8 It’s very common to encounter situations where as a programmer you realize that you basically need a duplicate of some code you’ve already got, but you just want to change some numbers.

Lesson 8 That’s a good time to write a function with a parameter; the parameter just acts as a placeholder for some value that you plug in at the time you call the function. Just like it’s considered good practice to give descriptive names to your functions, the same is true for the names of the parameters themselves.

Lesson 8 Watch the Video: Functions with Parameters – Video

Complete Code.org Lesson 8 Writing Functions with Parameters: Under the Sea

Review / End Day Next Class Quiz on Abstraction Video Lesson 9-