Introducing
Your new presentation assistant.
Refine, enhance, and tailor your content, source relevant images, and edit visuals quicker than ever before.
Trending searches
E- LEARNING
3 commands used in SQL
2 examples of utility software
1 SQL statement to return all Jaguar 'make' cars from the table 'Cars'
To know the difference between a function and a procedure
To know the advantages of using sub programs
To use sub programs to solve a problem
Sub programs
A mini program within your program
They SAVE TIME if we use repeated code in our program
Type the code out once and give it a name
When you want to use that block of code you just type the name
As well as saving time, sub programs:
+Make programs easier to edit once created
+Help debug errors
+Create a more logical structure to our code
Procedures are blocks of code stored under one name
Called by typing their name - sometimes we also pass an argument to them
VERY similar, but functions ALWAYS return a value back to be used in the main program
Functions always take at least one parameter
When calling a function we assign it to a variable - otherwise the value returned is lost!
Variables can be local or global
Any variable used within a sub program is local and can only be called within itself - if you try and print it in the main.....ERROR: NOT DEFINED!
This means you can use the same variable name as other local variables without any issues
Global variables can be used anywhere in the program
We can declare a global variable using the global key word
This means that they are accessible from both the main body and the sub programs
Task
Write a function takes two strings and joins them together with a space in between them.
Call your function and print out the result in the main program