GRASS (programming language): Difference between revisions

Content deleted Content added
m Correct pipe
Description: random is not a synonym for arbitrary
Line 43:
Zgrass also included a series of commands that "covered" CP/M, which allowed the disk to be accessed without exiting to the command prompt. You could easily save out macros to named files, and load them in the same way, allowing you to construct programs by loading up various macros from the disk into one large program. The commands also automatically made a backup copy of every save. Similar features were supported for [[Compact Cassette (data)|Compact Cassette]] storage, but oddly the syntax was not parallel: disk commands were D-something, like {{code|DPUT}}, but tape commands were not T-something, like {{code|TPUT}}, but rather something-TAPE, like {{code|PUTTAPE}}.
 
With programs constructed from randomlyarbitrarily selected modules, Zgrass needed to have better control over its variables than BASIC. In BASIC all variables are "global", so if two subroutines both use the variable {{code|I}}, which is very commonly used as a loop index variable, then they could set each other's values which leads to hard-to-debug problems. Under Zgrass a programmer loading up two modules could easily find that both used {{code|I}} as a loop counter, which could cause problems. To address this issue, Zgrass considered variables named with [[lowercase]] letters to be local only to that macro, so {{code|I}} and {{code|i}} were different variables, global and local respectively. Oddly, the examples provided with the language do not make widespread use of this feature, potentially confusing new programmers who might not be aware the feature exists.
 
==Example==