Skip to content

Instantly share code, notes, and snippets.

@lepinekong
Last active December 26, 2017 17:11
Show Gist options
  • Save lepinekong/842ae0b54414d44e806da2ffe770493f to your computer and use it in GitHub Desktop.
Save lepinekong/842ae0b54414d44e806da2ffe770493f to your computer and use it in GitHub Desktop.
??
??: func [
"Prints a word and the value it refers to (molded)"
'value [word! path!]
'comment [word! string! unset!]
][
switch/default type?/word get/any 'comment [
unset! [
prin mold :value
prin ": "
print either value? :value [mold get/any :value] ["unset!"]
]
word! string! [
prin mold :value
prin ": "
print rejoin [either value? :value [mold get/any :value] ["unset!"] " " mold comment]
]
][
]
]
f: func[][
test: "test"
?? test "comment"
]
f
f: func[][
test: "test"
?? test
g: func[][]
]
f
>> f
*** Script Error: ?? does not allow set-word! for its 'comment argument
*** Where: ??
*** Stack: print f ??
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment