How does 'Create Folder' give its result?

Rob Cozens rcozens at pon.net
Thu Mar 16 10:55:07 EST 2006


Hi Graham,

> As 'create' is not a function, I don't see any other way for it to 
> return a value.

Commands can return a value in "the result."

	create folder myPath
	get the result
	if it is not empty then
		beep
		answer error it
	end if

While not pertinent in this context, commands & functions can also 
return values via referenced parameters:

	function validDate theDate, at theDay, at theMonth, at theYear
		.... --parse theDate for validity
		if itsADate then
			convert theDate to dateItems
			put item 1 of theDate into theYear
			put item 2 of theDate into theMonth
			put item 3 of theDate into theDay
			return true
		end if
		return false
	end validDate

	on dateElements theDateItems, at theDay, at theMonth, at theYear
			put item 1 of theDateItems into theYear
			put item 2 of theDateItems into theMonth
			put item 3 of theDateItems into theDay
	end dateElements

In both the function and the command the values of the variables passed 
in the last three parameters are updated in the calling handler.

Rob Cozens
CCW, Serendipity Software Company

"And I, which was two fooles, do so grow three;
Who are a little wise, the best fooles bee."

from "The Triple Foole" by John Donne (1572-1631)




More information about the use-livecode mailing list