Hi! Today’s lesson was based mostly on basic functions but for the start of the lesson the class discussed the new terms of Actual and Formal Parameters.
Here is a small section of code that incorporates these two terms:
Call Doubler(Num)
Private Sub Doubler(ByVal N As Single)
The parameter used in the calling statement is properly known as the actual parameter. The actual parameter is what is passed to the procedure.
The parameter listed in the procedure heading is properly known as a formal parameter. The number, order and type of formal parameters must match the actual parameters, but their names can be different.
The rest of the lesson was to do with SD booklet 5 – User defined functions. Mr Stratton said that many of the functions would never appear in the exam but some important functions we might want to take note of were the Ucase function which converts lower-case characters into upper-case characters and the Lcase function which does the opposite. Another important function was the Mid$ function which extracts a sub-string from a string and also featured hugely in our program for the day. I have typed the part of the program for how to create the password below:
‘create the password
name1 = Mid$(name1, 1, 1)
name2 = Mid$(name2, 2, 1)
year = Mid$(year, 3, 2)
colour = Mid$(colour, 2, 2)
street = Mid$(street, 1, 3)
password = name1 + name2 + year + colour + street + shoe_size
Sorry if you get bored reading it all I guess.
Well that all folks!
A important part to today’s lesson was the discovery that Scholar’s examples are written for a different version of VB than we use. This caused a problem when I forgot to use the CALL command to call a procedure and as a result it would not pass the parameters.
I would like to add that it is better to use a function if your procedure only has one parameter.