0 points

Fortran, really.

In Fortran, variables beginning with the letters i through n have integer type by default, whereas all other letters imply a real-number (floating-point) variable. You can change this by declaring a type, but using i for a real is non-obvious.

(Hence the old joke, “God is real — unless declared integer.”)

permalink
report
reply
0 points
*

idk, this arbitrary i-n range behaving differently than other variables sounds like a terrible source of weird bugs to me. I don’t think variable names should ever change a program’s behavior.

edit:

Many old Fortran 77 programs uses these implicit rules, but you should not! The probability of errors in your program grows dramatically if you do not consistently declare your variables.

source

permalink
report
parent
reply
0 points

This comes from early years, when FORTRAN was introduced and the programmers needed to save space in the punch cards. Today, to avoid this possible source of bugs, you usually state “implicit none” in the preamble.

permalink
report
parent
reply
0 points

in programming, and in mathematics, it’s always been weird to me that frequently paired variables are basically the most easily confused for one another pairs, especially when written quickly or sloppily.

  • i and j
  • x and y
  • m and n
permalink
report
reply
0 points

exactly, this is so annoying. I don’t know by first-hand experience, but I also think p and q are confusing for dyslexic people.

permalink
report
parent
reply
0 points

i knew i was forgetting some other common pairings, thank you. p/q and u/v always bugged me too.

permalink
report
parent
reply
0 points

u and v were so difficult for me to differentiate in handwriting. My handwriting is not that pretty and the difference between a round bottom and a sharp bottom is not that big when stressed in an exam.

permalink
report
parent
reply
0 points
*

i for index or iteration. Using j, k, l… in loops signals (imho) that there is most likely an outer loop and the one using j, k, l are nested. x and y of course are carthesian coordinates . n is used as amount of substance in SI-unit-system, m is mass, maybe thats why it is used as amount of items in a set (Menge).

Programming computers have started to solve mathematical problems and math already used these symbols for centuries(?), so why you should change them? They are well established even in simple school mathematics. And at the end of the day a computer is nothing more than a calculator.

permalink
report
reply
0 points
*

Usually variables like that can be avoided with itterators nowadays. If they can’t I like to use idx, if they are nested I name them after what they index, like idx_rows, idx_cols.

permalink
report
reply
0 points

C would like to talk.

permalink
report
parent
reply

Linux

!linux@lemmy.ml

Create post

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

  • Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
  • No misinformation
  • No NSFW content
  • No hate speech, bigotry, etc

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

Community stats

  • 9.5K

    Monthly active users

  • 3.2K

    Posts

  • 37K

    Comments