In Fift, how does the `word` word work?
In Fift, how does the `word` word work?
Functions are called "words" in Fift, and there is a special `word` word. The whitepaper (https://ton.org/docs/fiftbase.pdf) explains it this way:
«*word (x – S)*, parses a word delimited by the character with the Unicode codepoint x from the remainder of the current input line and pushes the result as a String. For instance, `bl word abracadabra type` will print the string “abracadabra”. If *x = 0*, skips leading spaces, and then scans until the end of the current input line. If *x = 32*, skips leading spaces before parsing the next word».
But I don't fully understand how `x` works, could you explain it in different words? I see that some people use commands like `124 word`, what does that stand for? If I want to use `\n` as a word delimiter, what should I use?
---
> This question was imported from Telegram Chat: https://t.me/tondev/49423
Functions are called "words" in Fift, and there is a special `word` word. The whitepaper explains it this way:
«word (x – S), parses a word delimited by the character with the Unicode codepoint x from the remainder of the current input line and pushes the result as a String. For instance, `bl word abracadabra type` will print the string “abracadabra”. If x = 0, skips leading spaces, and then scans until the end of the current input line. If x = 32, skips leading spaces before parsing the next word».
But I don't fully understand how `x` works, could you explain it in different words? I see that some people use commands like `124 word`, what does that stand for? If I want to use `\n` as a word delimiter, what should I use?
---
> This question was imported from Telegram Chat: https://t.me/tondev/49423
#fift
In Fift, how does the `word` word work?
Functions are called "words" in Fift, and there is a special `word` word. The whitepaper explains it this way:
«word (x – S), parses a word delimited by the character with the Unicode codepoint x from the remainder of the current input line and pushes the result as a String. For instance, `bl word abracadabra type` will print the string “abracadabra”. If x = 0, skips leading spaces, and then scans until the end of the current input line. If x = 32, skips leading spaces before parsing the next word».
But I don't fully understand how `x` works, could you explain it in different words? I see that some people use commands like `124 word`, what does that stand for? If I want to use `\n` as a word delimiter, what should I use?
---
> This question was imported from Telegram Chat: https://t.me/tondev/49423