You can apparently define a function using the underscore character. Weird, huh?
I was looking for a way to shorthand multiple PRINT statements and Mr. K turned me on to the idea of creating a function P() to do so. I didn't care for the P, so I tried a bunch of other symbols. Nothing else worked - even emojis, but the underscore (_) did. In hindsight it makes sense since it can be part of a function name like "My_Function()". Another weird option is using a period and underscore "._()" as a function name. Crazy huh?
If you start any variable with a period, it becomes similar to a global variable. It's part of the scoped variables.
I've never thought of using an underscore in front of functions, or even variables.
Interesting...
George.
sarossell wrote:You can apparently define a function using the underscore character. Weird, huh?
I was looking for a way to shorthand multiple PRINT statements and Mr. K turned me on to the idea of creating a function P() to do so. I didn't care for the P, so I tried a bunch of other symbols. Nothing else worked - even emojis, but the underscore (_) did. In hindsight it makes sense since it can be part of a function name like "My_Function()". Another weird option is using a period and underscore "._()" as a function name. Crazy huh?
PRINT "Line 1"!_(5)!PRINT "Line 2" 'Notice the function "_(5)"
def _(x)
FOR n = 1 to x
PRINT
NEXT n
ENDDEF
George McGinn
Computer Scientist/Cosmologist/Writer/Photographer
Member: IEEE, IEEE Computer Society
IEEE Sensors Council & IoT Technical Community
American Association for the Advancement of Science (AAAS)