Re: Function initialization at the first call.
- Posted by SnakeCharmer Jan 19, 2013
- 1096 views
mattlewis said...
Possibly, but this could also lead to other program errors. Basically, it would be more difficult to catch places where you forgot to initialize something correctly, since we couldn't produce an error. In any case, there is no "default" variable value for any sort of euphoria objects, and I don't see that happening.
Matt
I mean that default value "" is convenient for building string with "&" and "append" operators. It will be really better to make here thus?
sequence String -- instead of: sequence String = "" function InitString() String = "" -- Sometime we should make it. for i = 1 to 1000 do String &= (remainder(i, 26) + 'A') end for end function export function getSymbol(integer Position) if not object(String) then InitString() end if return String[Position] end function