Hello all,
I am currently studying intro to programming (using Pseudocode), and need a bit of clarification on user defined functions. The example given in my text is:
I get that line 3 calls the Cube Function and transfers the value of 10 to that function.
What I don't get is how the value of 10 is given to the variable Side. My line of thought at the moment is...
Set LittleBoxx = Cube(10) //Call Function Cube and passes value of 10 to function Cube
Set Cube = Side^3 //Cube now = 10, I don't know how Cube passes its value to Side
By the way, I am eager to learn, this example is from Prelude to Programming: Concepts and Design 4E by Venit and Drake Page 391
I am currently studying intro to programming (using Pseudocode), and need a bit of clarification on user defined functions. The example given in my text is:
Code:
Main
Declare LittleBox As Float
Set LittleBox = Cube(10)
Write LittleBox
End Program
Function Cube(Side) as Float
Set Cube = Side^3
End Function
I get that line 3 calls the Cube Function and transfers the value of 10 to that function.
What I don't get is how the value of 10 is given to the variable Side. My line of thought at the moment is...
Set LittleBoxx = Cube(10) //Call Function Cube and passes value of 10 to function Cube
Set Cube = Side^3 //Cube now = 10, I don't know how Cube passes its value to Side
By the way, I am eager to learn, this example is from Prelude to Programming: Concepts and Design 4E by Venit and Drake Page 391