Try statement not working as I would have expected

Can anybody tell me why this does not work


on createMyFunction()
	script myFunction
		property myValue : 20
	end script
	return myFunction
end createMyFunction

set myObject to createMyFunction()

tell myObject
	return myValue
end tell

I get the error message “The variable myValue is not defined.”

I thought as soon as I used the tell statement it would be targeting all my statements as if I had the syntax “of myObject” at the end of it.

Hi,

try this


.
tell myObject
	return its myValue
end tell

Thanks for that. I have not come across the “its” key word yet. More reading to come.