Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.postscript > #3329
| Newsgroups | comp.lang.postscript |
|---|---|
| Date | 2018-11-07 20:17 -0800 |
| References | <f6bea1cb-1861-49ac-9a6c-6cfba86e3a42@googlegroups.com> |
| Message-ID | <a99ddfda-7982-4cd7-9bf5-180e6b896350@googlegroups.com> (permalink) |
| Subject | Re: postscript newbie has questions |
| From | luser droog <luser.droog@gmail.com> |
On Wednesday, November 7, 2018 at 5:59:49 PM UTC-6, Eric Lovejoy wrote: > One problem I am having a hard time with is understanding how to change a variable, after defining it. Tackling just this one question. Part of the difficulty I think you're running into is that PostScript doesn't really have the same concept of a *variable* that other programming languages have. Instead, it's more useful to think in terms of *definitions*. A definition is a binding of a name (usually) and another object in a dictionary. When you do /num 42 def you have to use the slant character / to warn the interpreter not to just look up the name and fetch the value right then and there. And you'll have to use the same formula every time you *assign* a new value to the "variable". If the value is already on the stack, then you usually have to use 'exch' to get the pieces in the right order. % 42 already there /num exch def Hopefully this much info is enough for you to solve your problem and move on. But don't hesitate with further questions or follow-ups. Good luck with PostScript! droog
Back to comp.lang.postscript | Previous | Next — Previous in thread | Next in thread | Find similar
postscript newbie has questions Eric Lovejoy <blicken@gmail.com> - 2018-11-07 15:59 -0800 Re: postscript newbie has questions luser droog <luser.droog@gmail.com> - 2018-11-07 20:17 -0800 Re: postscript newbie has questions Scott Hemphill <hemphill@hemphills.net> - 2018-11-12 09:12 -0500
csiph-web