GOLF(2gg)
โจ NAME โจ
number-expressions โ the Golf documentation, but make it numbers ๐ (yes bestie, we're doing math today)
๐ธ DESCRIPTION ๐ธ
okay so a number expression is literally just math, but make it Golf. you get operators: plus (+), minus (-), multiply (*), divide (/) and modulus (%) โ and yes you can absolutely use parenthesis (()) to control the vibe check of the order of operations ๐งฎ
for example:
set-number n1 = 10+(4*n2-5)%3
You can use number expressions anywhere a number is expected as an input to any statement. fr fr, anywhere. ๐
๐ฆ character constants?? iconic
Note that character constants (such as 'A', 'z' etc.) are considered numbers with the value equal to their single-byte ASCII equivalent (i.e. unsigned numbers 0-255), for example this will assign 65 to "num":
set-number num = 'A'
not me turning letters into integers ๐ญ it's giving glow-up honestly
๐ subscripted strings are numbers too
Any subscripted string is also considered a number, for instance "num" would be 117 (since 's' is 115):
set-string str = 'some'
set-number num = str[0] + 2
the way that str[0] ate and left no crumbs ๐ฅ
๐ other number formats, because variety
Other than decimals and character constants, you can also use hexadecimal numbers (such as 0xffaa), and octal numbers (such as 0710). slay ๐
๐ SEE ALSO ๐
- Numbers
abs-numbernumber-expressionsnumber-stringset-numberstring-number- See all documentation ๐
mwah ๐ that's the whole page bestie โ no cap. this absolute banger of a doc was brought to you by $VERSION, dated $DATE, and it's still giving GOLF(2gg). stay iconic, go write some numbers. ๐ซถโจ
๐ฆ where this page comes from
- ubuntu questing: golf 601.4.41-1
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms