What is LessonUp
Search
Channels
AI tools
Log in
Register
‹
Return to search
Functions and Methods in Programming
Functions and Methods in Programming
1 / 12
next
Slide 1:
Slide
Computer Science
This lesson contains
12 slides
, with
interactive quizzes
and
text slides
.
Lesson duration is:
45 min
Start lesson
Save
Share
Print lesson
Items in this lesson
Functions and Methods in Programming
Slide 1 - Slide
What is a Function?
A Function is a
REUSABLE
block of code that performs a specific task. Functions
can
take arguments and
can
return values, but neither is required.
Slide 2 - Slide
Why do we use functions?
To make code shorter
To reuse instructions
To confuse the computer
To avoid variables
Slide 3 - Poll
Parts of a Function
Name - Label to call the function
Arguments - Variables that are passed into the function
Body - Steps to follow
Return - The output or result of the function
Slide 4 - Slide
Can you think of something you do every day that could be a function?
Slide 5 - Open question
Slide 6 - Slide
Practice
Create a function called Greetings. Greetings takes one argument and returns a greeting using the name.
Create a function called Add that takes two numbers ("a" and "b"). Return the value of a + b
Slide 7 - Slide
What is a function in coding?
A
A type of variable
B
A reusable block of code
C
An error in code
D
A data structure
Slide 8 - Quiz
What are arguments in a function?
A
Local variables
B
Values passed to a function
C
Function names
D
Return values
Slide 9 - Quiz
What does a return statement do?
A
Exits a function and gives output
B
Calls another function
C
Creates a loop
D
Defines a function
Slide 10 - Quiz
Can a function have multiple arguments?
A
Only numbers as arguments
B
Yes, it can have many arguments
C
No, only one argument allowed
D
Only strings as arguments
Slide 11 - Quiz
What is a method in coding?
A
A function associated with an object
B
A type of loop
C
A variable type
D
An error handler
Slide 12 - Quiz
More lessons like this
Programming A Screen Turtle
December 2023
-
19 slides
Computing
Primary Education
LessonUp Inspiration
Time Travelling Programmers
September 2024
-
14 slides
Computing
Primary Education
LessonUp Inspiration
Computing On Spreadsheets 1-2 Lesson Help
February 2024
-
12 slides
Computing
Primary Education
LessonUp Inspiration
British Science Week: Coding with SCRATCH
October 2025
-
14 slides
New lesson editor
Computing
LessonUp
Primary Education
Lower Secondary (Key Stage 3)
LessonUp UK Spotlight
Intro to Scratch
December 2023
-
26 slides
Computing
Primary Education
LessonUp Inspiration
Essay Writing - Exemplar Breakdown (level 2-3)
March 2025
-
11 slides
LessonUp
Upper Secondary (Key Stage 4)
Special Education
Lower Secondary (Key Stage 3)
Further Education (Key Stage 5)
Teaching and Learning Techniques
News Quiz - Week 35
September 2025
-
12 slides
New lesson editor
Citizenship
News
+3
Primary Education
Lower Secondary (Key Stage 3)
Upper Secondary (Key Stage 4)
LessonUp News Quiz
News Quiz - Week 35
September 2025
-
12 slides
New lesson editor
Citizenship
News
+3
Primary Education
Lower Secondary (Key Stage 3)
Upper Secondary (Key Stage 4)