Re: How to name variables in a program?



August Karlstrom wrote:

> In mathematics

The problem with math is mathematicians are too smart, so they don't have to
be clear.

> Note that single letter variable names are generally preferred for
> (trivial) loop variables as long names obscures the code. Compare
>
> FOR k := 0 TO LEN(a) DO
> a[k] := 0
> END

Whence Ruby's

a.each { |q| consider(q) }

The k went away entirely. q refers to a[k].

(But if it's an imediate value, like an integer, you can't = 0 it. So
a.collect{0} or something.)

--
Phlip
http://www.c2.com/cgi/wiki?ZeekLand


.


Quantcast