to Rob (isn't this a bit silly)

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

This function is a function that I am using to trim off whitespace at the=

end of a sequence.  I am forced to put a statement in there that will
never, never, never, never, and yes, never, be executed to make the
interpreter happy.  Why am I faking out the interpreter?  'cause otherwis=
e
it wines.  This defeats Euphoria's purpose of elegance.

global function rtrim(sequence string)
    if string[length(string)] =3D ' ' then -- if last character
        string =3D string[1..length(string)-1] -- if space, take it away
    else
        return string -- ok, last character isn't a space, done, get out
    end if
    string =3D rtrim(string) -- recursive call to check another character=

    return string -- Now, please explain to me the elegance or purpose of=

-- having this statement
end function

Now, couldn't you make "attempting to exit from a function without return=
"
a run-time error instead of compile-time?  If you can't, then I will take=

it as a limitation of Euphoria's mother language, C.

--Alan
  =

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

Search



Quick Links

User menu

Not signed in.

Misc Menu