RE: BUG in EUPHORIA PARSER

new topic     » goto parent     » topic index » view thread      » older message » newer message

Sabal.Mike at notations.com wrote:
> This is not a bug.  "return" needs an atom as a parameter.  
> ctrl+=1 is an assignment, not an atom.
> ctrl = ctrl + 1 is a boolean expression that will always return 0 
> (a number can never be one greater than itself).  Try this:
> 
> function inc(object o)
>   return o+1
> end function
> -- remember that operators can work on both atoms and sequences.
> 
> or on a global or file variable:
> 
> function incg() -- assumes ctrl has already been defined and initialized
>   return ctrl+1
> end function
> 
> ctrl = incg()
> 
> or if I want to program a shortcut function:
> 
> function incg() -- see above
>   ctrl+=1
>   return ctrl
> end function
> 
> for ctr = 1 to 10 do
>  ? incg()
> end for
> 
> or probably the best way to shortcut:
> 
> procedure incg() -- note that this is a procedure, not a function; 
> assumes ctrl
>   ctrl+=1
> end procedure
> -- this is more Pascalesque.
> if some_condition then
>   incg()
> end if
> 
> HTH,
> Michael J. Sabal

Thanks Brian and Michael for the explaination.

I wasn't do what I though I was doing.

Bernie

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu