[Oberon] Re (2): Removing WITH

peter at easthope.ca peter at easthope.ca
Sun Dec 31 15:13:29 CET 2023


Pfoten & all,

From:	pfoten.falken0p at icloud.com
Date:	Sun, 31 Dec 2023 15:39:04 +0100
I guess I’d be rather use a temporary variable than repeating the guard, ...

Yes, for most, this may be preferable.

	PROCEDURE Seek(R: ListRiders.Rider; key: SIGNED32);
		VAR r: Rider;
	BEGIN
		r := R(Rider);
		r.key := key; r.pos := 0; r.sortPos := 0;
		WHILE (r.pos < noMsgs) & (msgs[r.pos].pos # key) DO
			INC(r.pos)
		END;
		IF r.pos >= noMsgs THEN
			r.key := -1; r.pos := -1; r.sortPos := -1; r.eol := TRUE
		ELSE
			IF r.sort # NIL THEN
				WHILE msgs[r.sort[r.sortPos]].pos # key DO
					INC(r.sortPos)
				END
			END;
			r.d(ListRiders.Int).i := r.pos
		END
	END Seek;

Thx,                        ... P.L.

-- 
VoIP:   +1 604 670 0140
work: https://en.wikibooks.org/wiki/User:PeterEasthope



More information about the Oberon mailing list