Re: to Rob (isn't this a bit silly)

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

>global function rtrim(sequence string)
>    if string[length(string)] = ' ' then -- if last character
>        string = 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 = 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

>--Alan

As has already been stated, that line IS used.  You might perhaps try:

global function rtrim(sequence string)
    if string[length(string)] = ' ' then
        string = string[1..length(string)-1]
        return rtrim(string)            <--------<<<
    else
        return string
    end if
end function

I haven't checked it for speed, but it at least looks more elegant to me.

Isaac

"I am amused by the simplicity of this game.  Bring me your finest meats
and cheeses."

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

Search



Quick Links

User menu

Not signed in.

Misc Menu