I am using a tutorial/explanation of functions provided to me by absconditus in this forum when I previously posted a question about something.
It is located here:
http://www.absconditus.com/articles/oop1.htm
So far, it has been great really helping me “get” some things.
Right now I was going through the part about functions with multiple arguments.
My <b>first question</b> is what do the double quotes in the output value represent? (in bold below)
<hr>
//simple function with variables (multiple arguments)
//declare the function
//include the names of the variables when you declare the function, in parenthesis
function greetings(message,username)//says the name of the function is greetings
{ //signifies the beginning of the function, all code within curly brackets belongs to the function
<b>trace(message + " " + username + “!”); </b> //outputs the value of message and username
//which are the arguments (parameters) given below when the function is called
} //end greetings()
//in order to execute the function, you must call it…tell it to “play”
//call the function and send “Welcome retrotron” as the values of message and username
greetings(“Welcome”,“retrotron”);
//These variables (“Welcome”,“retrotron”) are being passed into the function and
//are parameters or arguments
<hr>
Anyway my <b>second question</b> is what is the difference between using a function like that to call multiple arguments or using it like the way I have below? Is one way better or does it suit a certain purpose?
<hr>
//simple function with variable example
//declare the function
//include the name of the variable when you declare the function, in parenthesis
function helloWorld2(myVar)//says the name of the function is helloWorld2
{ //signifies the beginning of the function, all code within curly brackets belongs to the function
trace(myVar); //outputs the value of myVar
} //end helloWorld2()
//in order to execute the function, you must call it…tell it to “play”
//call the function and send “Hi, my name is Jill” as the value of myVar
helloWorld2(“Hi, my name is Jill!”);
helloWorld2(“Today is Friday”);
helloWorld2(“It rained last night.”);
//This variable (“Hi, my name is Jill!”) is being passed into the function and
//is a parameter or argument
//so, you can call the same function many times and pass different varibles, getting different results
//see lines 12 and 13 for examples
<hr>
Thanks for any explanations!
:beam: