Re: Function initialization at the first call.

new topic     » goto parent     » topic index » view thread      » older message » newer message
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 
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu