Which code do you prefer?

Which code do you prefer? a.For i := 1 To Strlen(OldText) Do NewText[Strlen(OldText) - i + 1] := OldText[i]; b.FOR i := STRLEN(StringToConvert) DOWNTO 1 DO ConvertedString += FORMAT(StringToConvert[i]); c.FOR i := STRLEN(StringToConvert) DOWNTO 1 DO ConvertedString := ConvertedString + FORMAT(StringToConvert[i]); All do the same. Just choose the one you prefer and think is better. You want to know why this question is asked? Read topic “!rorre draobyeK”.

C! course it’s the best!

It’s obvious that you placed my code at the top (item a) because deep down you know that it’s the best, more efficient and most elegant [:D]

Surely the topic should have been: Who has wasted the most time today in the breakspace forum? a) Emiel b) André c) Heinz Clearly my vote goes to a) as the originator of the topic!

quote:


Originally posted by SBWEAVER
Surely the topic should have been: Who has wasted the most time today in the breakspace forum? a) Emiel b) André c) Heinz Clearly my vote goes to a) as the originator of the topic!


[B)]

quote:


Originally posted by SBWEAVER
Surely the topic should have been: Who has wasted the most time today in the breakspace forum?


ROFLMAO [:D][:D][:D]

true, so true… about that topic thing that is… Not you have better code course it’s option a. I did that so you wouldn’t use that when you lost. btw, nice work… making your collega’s vote your own code!

quote:


Originally posted by eromein
btw, nice work… making your collega’s vote your own code!


[?] Hm? I made his vote my code? I forced him to vote for me? I stole his code? [:D]

I voted for a) Less lines than c) no offensive CAPS Anyone want to make a stupid programmer out of an implementor? [:D]

Sry Heinz Herbeck, lost track of discussions and people. But I’m back on who is who and who has which discussion with what people. So, nice work… making your collega’s vote your own code Heinz Herbeck! [;)]

Blatant canvassing/influencing of opinion, not to mention getting a star for a break space topic!! http://www.navision.net/forum/topic.asp?TOPIC_ID=6223

Break space is not included in the rating system.

quote:


Originally posted by eromein
Break space is not included in the rating system.


But Emiel your posting into the Developer Forum is included in the rating system [;)]. bye André

quote:


Originally posted by eromein
Break space is not included in the rating system.


Yes, but you posted in the developer forum to advertise for this poll, and this advertisment does count. [:D]

sure, But it sould be in the developers forum, the only thing is that you can not create any polls there.

Just to be sure! A poll only for Emiel & Heinz: Is this thread (and the mirror thread) still a fun - thread? o YES o NO o DON’T KNOW

Yes, I’m gonna win… That’s why!

Performance wise, (a) is awful. Don’t put STRLEN into a loop when its a constant, as in this case, and is being recalculated unnecessarily for every iteration. In a serious programming environment you’d be flayed alive for that!

Robert, I agree entirely. That’s why I mentioned in my original code proposal that Strlen should be assigned to a variable. Emiel omitted this statement in the poll - I suppose he did so on purpose to keep the votes for my code low [:D]

lol, sure, sure… But guys. It isn’t about performance here. Code a is faster then both b and c. Course of the format in the loop, this will make it “slow”. But what’s in the name? In a loop of 10000 times code a is 100 ms faster. 100 ms! You can’t even blink you eyes in that time. It’s about how easy the code can be read without the use of comments. And frankly I really dont know why you don’t use the DOWNTO functionality of the “FOR” loop.