GOLF(2gg)

๐Ÿ“ฆ version 601.4.41, in ubuntu questing

โœจ 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-number
  • number-expressions
  • number-string
  • set-number
  • string-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