The EGL Service part is like a program that has multiple entry points.
Service MyService{}
// variables and constants can be here
function calculate(myScore INT[]) returns (BIN (4,2))
numberOfScores, i, mySum INT;
numberOfScores = myScore.getSize();
for (i from 1 to numberOfScores by 1)
mySum = myScore[i] + mySum;
end
return(mySum/numberOfScores);
end
// other functions are here
end
The function calculate receives an array of integers and then calculates and returns the average. The service can make multiple functions available to service requesters.
For further details, see “Services: a top-level overview” and its subtopics.