Sb forum speech.png DiscordLink.png FacebookLink.png RedditLink.png SteamLink.png TwitterLink.png YoutubeLink.png

YOLOL Tricks

From Starbase wiki
Revision as of 22:07, 19 September 2020 by Sparr (talk | contribs) (First version of page)

(diff) ← Older revision | Approved revision (diff) | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

YOLOL is a rather constrained language. The line and chip length limits and slow execution speed incentivize clever shortcuts. The small math library and limited operation space require building larger operations from smaller building blocks. To those ends, this page serves to catalog a variety of things you can accomplish with YOLOL that might not be obvious from the main [YOLOL] documentation.

String Manipulation

Nickname Code Explanation
Pop string---string Evaluates to the last character in string and removes that character, "abcd" becomes "abc" while evaluating to "d"
If Empty string-(string+otherstring) If otherstring is empty then this evaluates to string, else it evaluates to an empty string

Code Golf

If you want to develop readable code and only shorten it for deployment, consider using yodk or Yololc which can minify your code for you.

Shortening identifiers to one character saves bytes, use f=b rather than foo=bar.

Reassigning fields to identifiers saves bytes if you use them more than a few times. f=:f f f f f f f f f is shorter than :f :f :f :f :f :f :f :f .

Most whitespace is optional. You only actually need a space when code would be ambiguous without it. Spaces can almost always be omitted before :, after if or then or end, between a number or symbol and a letter, and in various other places.

Cookies help us deliver our services. By using our services, you agree to our use of cookies.