I'm working my way through a programming book which uses pseudocode for all of its examples and I came across Float: function()
as a function parameter, like so:
Float: UseTrapezoidRule(Float: function(), Float: xmin, Float: xmax, Integer: num_intervals)
// Calculate the width of a trapezoid.
Float: dx = (xmax - xmin) / num_intervals
// Add up the trapezoids' areas.
Float: total_area = 0
Float: x = xmin
For i = 1 To num_intervals
total_area = total_area + dx * (function(x) + function(x + dx)) / 2
x = x + dx
Next i
Return total_area
End UseTrapezoidRule
I have seen parameters such as Float: x
which I understand, but I don't know what the first parameter Float: function()
means or does exactly. FWIW, I'm a JS developer. I never have to declare function param types but I understand the concept.