In: Electrical Engineering
FOR THE FUNCTION CALLS OR OTHER DEFINED VARIABLES USING THE EXECUTIONS SUCH AS
EX) WHILE(), FOR(), IF(), DO() AND ETC LOOPS OR
CLASS INHERETANCES EX) something.something, etc.
WHAT ARE DIFFERENCES BETWEEN?
ARE THERE DIFFERENCES BETWEEN THE TYPES? EX) WHAT KIND OR TYPES OF VARIABLES CAN BE USED TO DEFINE IT?
WHAT ARE THE TAKE AWAY POINTS OF THESE MENTIONED?
Function in any language of programming has two role first you define it by any name you pass the input variable which you are going to use inside that function defination and set of out put
And now after definning input and output varibles of function we give each its parameter its defintions
For example in matlab function is defined as
Function (output variables)=name of function (input variables)
Using any of logic statement algebric mathematical etc
Now suppose you call that function at any excutable instruction which is needed to use its output variable you simply pass the name of fuction whereever you want to call and pass the values of input variable .
For example say we run
If statement
If (condition of statement)
Call function by its name(pass values of input variables)
Use the output values of that variable in this
Conditional statement
End
The above given proceess follow for for looping while stsement or any kind of above given logical statements to use function by calling its name.
To define the function the type of variable passed could be single valued
Or in form of array or matrix or integer actually function doesnot see what is type of variable you are passing but the thing is while calling function at any time in ypur code ypu must see the output of defined function is compatble with given lones of code of not.
Takeways
1. see defining and calling function makes our program compact and lesser lines of code and gives better understanding and structure to coding.
2. we can call anywhere at any code program to the defined and saved program and use it we donnt have to wrote that code set within function again.
3. Type of variable is independent of function defintion rather how you use it in output by you function dwfintion is rather more impprtant.