Home
The HyperCard Center
HyperTalk Reference
Home » HyperTalk Reference » average

Note: This is a work in progress and many formatting issues have been fixed. Read more about the project on the home page.

average

average(numberList)

Value returned: number equal to the arithmetic average of the comma-separated list of numbers

Examples

average(1,2,3,4,5,6,7,8,9,10)
repeat with N = 1 the number of lines of field "Number Data"
put line N of field "Number Data" into item N of theNumbers
end repeat
put average(theNumbers)

Demo Script

on onAverage
repeat with numLine = 1 to the number of lines of me
put the number of words of line numLine of me into¬
item numLine of wordsInEachLine
end repeat
put "There are an average of" && average(wordsInEachLine) && ¬
"words in each line of this field." into sayIt
answer sayIt
end onAverage

Related Topics

Placeholders

numberList

A comma-separated list of numbers.

1,2,3,4,5
"1.2,2.2,3.2"

In AppleScript, the list must be enclosed in brackets:

{1,2,3,4,5}

HyperTalk Reference

Version 0.8b4 (July 4, 2025)

Made with Macintosh

Switch to Retro View