in reply to A Quesiton of Numbers

Line numbers make your code far less flexible.

If your want to insert a piece of code, you will have to renumber all your lines. Sure, you might number with increments of 10, but then, what if you want to insert 11 lines of code? Or first you insert 10 lines, then later on, between that, another 10?

Also, what are you going to do with statements that are longer than a line? Can you just arbitrary put numbers in those statements? It gets worse with strings that span multiple lines. Do they need to be numbered?

The bottom line is, there is absolutely no reason to number the lines of your code. If you find it handy to have line numbers while coding, use power editor like vi that will allow you to view line numbers.

Note that you can use line numbers in Perl. Or at least, sort of:

L0: print "Begin of program.\n"; L1: print "Hello, world.\n"; L2: ;# Some comment. L3: print "End of program.\n";
Begin of program.
Hello, world.
End of program.

Abigail

Replies are listed 'Best First'.
Re: Re: A Question of Numbers
by Foncé (Scribe) on Jul 10, 2002 at 19:41 UTC
    Well, that settles that. I wasn't necessarily planning on programming by numbers, but I wanted to gather thoughts on doing so. Fortunately, I've been working for a long time without line numbers, so I'll be just fine there.

    As for a language that should be used for beginning programmers...as said above, BASIC isn't bad, but it isn't good, either. Perhaps Java would be a good way to start out. The school I attended has since dropped BASIC and gone to C, which I think is a mistake (due to complexity).

    You never know what you'll learn from asking a question like this :)