From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109fba,ec5e801e70a0a8f1,start X-Google-Attributes: gid109fba,public X-Google-Thread: 103376,ec5e801e70a0a8f1,start X-Google-Attributes: gid103376,public X-Google-Thread: 101deb,ec5e801e70a0a8f1,start X-Google-Attributes: gid101deb,public X-Google-Thread: 1014db,6154de2e240de72a X-Google-Attributes: gid1014db,public From: rav@goanna.cs.rmit.edu.au (++ robin) Subject: Re: Should I learn C or Pascal? Date: 1996/07/25 Message-ID: <4t6hrs$kid@goanna.cs.rmit.edu.au>#1/1 X-Deja-AN: 169986047 references: organization: Comp Sci, RMIT, Melbourne, Australia newsgroups: comp.lang.c,comp.lang.c++,comp.lang.ada,comp.lang.pl1 nntp-posting-user: rav Date: 1996-07-25T00:00:00+00:00 List-Id: dewar@cs.nyu.edu (Robert Dewar) writes: >"An algorithm is just a set of instructions on how to accomplish a task. An >algorithm does not depend at all on any sort of programming "language". In >fact, I was taught that you should write out your "game plan" and psuedo >code before you even touch any sort of syntax in any language. Yes, I do >tend to write up my psuedo-code in a C-like syntax frequently but you >don't need to. > Loop until variable is equal to 7 > Add 1 to variable > Print out the following string to screen: ;-) > end of loop >There's an algorithm written in plain english." ---To be an algorithm, it must be definite. This one isn't. The variable "variable" must be intialized. >First of all "pseudo-code" is still written in a language, which has syntax >and semantics. The trouble with an algorithm written in "plain english" >like the above is that it is imprecise. For example does the string that >is written to screen include a leading blank? I have no idea from the above. >If variable is 2**32-1, does the above still work? I have no idea. >Are the strings on separate lines of the screen? I have no idea. >writing > while variable /= 7 loop > variable := variable + 1; > put_line (";-)"); > end loop; >is less writing than you did, just as clear, and importantly, exactly >precise ---This isn't any more of an algorithm than that of the previous writer. The variable "variable" still isn't initialized. Now, how about: DO I = 1 TO 7 BY 1; PUT SKIP LIST ( ';-)' ); END; is abundantly clear that the loop is being executed with clear start and finish values of the control variable. Furthermore, the loop will be executed exactly 7 times. Might be better to consider learning PL/I . . .