Path: utzoo!attcan!uunet!ncrlnk!ncr-sd!hp-sdd!hplabs!hpfcdc!hpldola!hpctdlb!hpctdls!rbk From: rbk@hpctdls.HP.COM (Richard Katz) Newsgroups: comp.lang.misc Subject: Re: colon-equal vs equal Message-ID: <3290002@hpctdls.HP.COM> Date: 22 Dec 88 18:09:12 GMT References: <3300001@uxg.cso.uiuc.edu> Organization: Hewlett-Packard CTD, Colo. Spgs. Lines: 28 >/ hpctdls:comp.lang.misc / phil@uxg.cso.uiuc.edu / 2:36 pm Dec 20, 1988 / >How did the := come into being in languages like Algol, Pascal, and Ada? >I still prefer the way it is in C (and a little lesser so in Rexx and >Fortran). My second beef against := is the extra character. My FIRST >beef against := is the KeYbOaRd ShIfTiNg I hAvE tO kEeP dOiNg FoR iT. ---------- I don't know how the := came into being, but I don't have any beef about it. In fact, I think Pascal use of it is good. Pascal uses = as a boolean operator and := as asignment. First, := seems better since i = i + 1 looks real funny. Also, a nice feature is that 'if ( i := 10 )' will produce a syntax error in Pascal while 'if ( i = 10 )' will produce an assignment in C, usually not intended. FORTRAN uses .EQ. to make sure that there is no mixup between the assignment operator and the comparison operator. Perhaps i <- 10 would make more sense than := although it is slightly more awkward to type. Typing the extra character is not that hard and more than pays for itself by eliminating the occasional typo in Boolean expressions. rich katz hewlett packard p o box 7050 colorado springs, co 80933-7050 email: rbk@hpctdlb.hp.com