Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Required fields*

Tips for golfing in Pascal

What general tips do you have for golfing code in Pascal?

I know this is a tricky language very few people use this but I would like to know any tips from the professionals out there. :)

I'm looking for tips that can reduce code size (every byte counts!) with special functions or even crazy combinations.

Please post each tip as a separate answer and avoid tips not specific to Pascal (e. g. remove whitespace, etc.). For tips tailored to the Delphi programming language, a popular dialect of Pascal, see Tips for golfing in Delphi.

Answer*

Draft saved
Draft discarded
Cancel
2
  • 3
    \$\begingroup\$ This is a bit of a misconception: Both for and if require one statement. The begin ... end frame represents one statement. There is no "short" or "long" form of either of them. \$\endgroup\$ Commented Mar 6, 2023 at 19:47
  • \$\begingroup\$ The formal construct (e.g. if x>y then begin;inc(k);writeln(a);end;) allows one or more statements. But if there's only one statement, begin and end are optional.. maybe this is too elemental \$\endgroup\$ Commented Mar 6, 2023 at 20:10

AltStyle によって変換されたページ (->オリジナル) /