From 1a1f1365e66e17610aaf65d73ce974b0fb556396 Mon Sep 17 00:00:00 2001 From: Rangi <35663410+Rangi42@users.noreply.github.com> Date: Sun, 28 Aug 2022 15:16:49 -0400 Subject: [PATCH] Clarify the FOR loop documentation (#1031) Clarify the FOR loop documentation Fixes #1003 Co-authored-by: Eldred Habert --- man/rgbasm.5 | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/man/rgbasm.5 b/man/rgbasm.5 index 3c4550ee..6a83e532 100644 --- a/man/rgbasm.5 +++ b/man/rgbasm.5 @@ -1804,11 +1804,29 @@ The value will be updated by .Ar step until it reaches or exceeds -.Ar stop . +.Ar stop , +i.e. it covers the half-open range from +.Ar start +(inclusive) to +.Ar stop +(exclusive). +The variable +.Ar V +will be assigned this value at the beginning of each new iteration; any changes made to it within the +.Ic FOR +loop's body will be overwritten. +So the symbol +.Ar V +need not be already defined before any iterations of the +.Ic FOR +loop, but it must be a variable +.Pq Sx Variables +if so. For example: .Bd -literal -offset indent FOR V, 4, 25, 5 PRINT "{d:V} " + DEF V *= 2 ENDR PRINTLN "done {d:V}" .Ed