Home THE HYPERCARD CENTER

HyperTalk Reference
Home » HyperTalk Reference » Functions

Note: This is a work in progress and will be formatting errors. Read more about the project on the home page.

length

the length of expression
Value returned: the number of characters in the value of the expression


Examples

length of "Hello world"
length("Hello world")

length of field "Index"
length of myVar

length of 3 + 2 -- returns 3
length of (3+2) -- returns 1

Demo Script

on lengthOfMe
  put the length of bkgnd field "Demo Script" into numChars
  answer "This demo script contains" && numChars && "characters."
end lengthOfMe

Placeholders

expression
HyperTalk DefinitionAny HyperTalk expression. All expressions evaluate to text, a number, or a constant.

For example:

true
sin(90)
"this is" && it
(3+2) = 5
the heapspace div 1024


Note: Formally, HyperCard distinguishes between factors (simple values) and expressions. The difference between factors and expressions matters only if you like to drop parentheses. Most functions take factors as their parameters, which is why length of 3 + 5 returns 6 and length of (3 + 5) returns 1. In short, always use parentheses to group things the way you want them to evaluate, and you won’t have to worry about the difference between factors and expressions.

AppleScript DefinitionAny series of words that has a value.

Related Topics

« heapSpace | HyperTalk Reference | ln, ln1, log2 »


Version 0.7b1 (March 24, 2022)

Made with Macintosh

Switch to Modern View

Home
The HyperCard Center
HyperTalk Reference
Home » HyperTalk Reference » Functions

Note: This is a work in progress and will be formatting errors. Read more about the project on the home page.

length

the length of expression
Value returned: the number of characters in the value of the expression


Examples

length of "Hello world"
length("Hello world")

length of field "Index"
length of myVar

length of 3 + 2 -- returns 3
length of (3+2) -- returns 1

Demo Script

on lengthOfMe
  put the length of bkgnd field "Demo Script" into numChars
  answer "This demo script contains" && numChars && "characters."
end lengthOfMe

Placeholders

expression
HyperTalk DefinitionAny HyperTalk expression. All expressions evaluate to text, a number, or a constant.

For example:

true
sin(90)
"this is" && it
(3+2) = 5
the heapspace div 1024


Note: Formally, HyperCard distinguishes between factors (simple values) and expressions. The difference between factors and expressions matters only if you like to drop parentheses. Most functions take factors as their parameters, which is why length of 3 + 5 returns 6 and length of (3 + 5) returns 1. In short, always use parentheses to group things the way you want them to evaluate, and you won’t have to worry about the difference between factors and expressions.

AppleScript DefinitionAny series of words that has a value.

Related Topics

« heapSpace | HyperTalk Reference | ln, ln1, log2 »

Version 0.7b1 (March 24, 2022)

Made with Macintosh

Switch to Retro View