Re: Function initialization at the first call.
- Posted by jimcbrown (admin) Jan 17, 2013
- 1215 views
mattlewis said...
SnakeCharmer said...
For example, I need function for exctraction of values from some sequence. This sequence must be builded before any extractions (for example, filled with random data). How to do such initialization? I thought up only one way yet.
More or less...in 4.0 you can also use object() to determine if a variable has been initialized:
sequence String function InitString() String = "I'm initialized now!" end function export function SymbolFromString(integer Position) if not object(String) = 0 then InitString() end if return String[Position] end function
Matt
Err ... shouldn't that be
if object(String) = 0 then
or
if not object(String) then