Singly-linked list/Element removal: Difference between revisions
→{{header|Fortran}}: Mnemonics and intent.
(→{{header|Fortran}}: A full file scheme.) |
(→{{header|Fortran}}: Mnemonics and intent.) |
||
Line 106:
END IF !So much for that node.
</lang>
The introduction of a mnemonic "NEXT" might help the interpretation of the code, but one must be careful about phase: NEXT is the "nextness" for IT which fingers node NEXT which is the candidate for matching against X, not IT.
And ... there is a blatant GO TO (aside from the equivalent concealed via RETURN) but using a WHILE-loop would require a repetition of NEXT = LINK(IT). If Fortran were to enable assignment within an expression (as in Algol) then <lang Fortran> IT = 0 !This list element fingers the start of the list..
DO WHILE((NEXT = LINK(IT)).GT.0) !Finger the follower of IT.
IF (NEXT.EQ.X) THEN !Is it the unwanted one?
|