AskedValue

AskedValue["key"]

is a construct for use inside AskFunction that gives the value associated with key, or Missing[] if none has been provided.

Details

  • If a value has already been associated with a key, AskedValue returns that value just like Ask. But unlike Ask, AskedValue will never request a value from the user, instead returning Missing[] if no value has yet been provided.
  • When no value is yet known for the requested key, AskedValue["key"] returns Missing["NotAsked","key"].

Examples

Basic Examples  (2)

AskedValue returns the value whenever it is already known:

But returns a Missing object whenever it is not known yet:

AskedValue returns the value without causing a form to be displayed:

Wolfram Research (2016), AskedValue, Wolfram Language function, https://reference.wolfram.com/language/ref/AskedValue.html.

Text

Wolfram Research (2016), AskedValue, Wolfram Language function, https://reference.wolfram.com/language/ref/AskedValue.html.

CMS

Wolfram Language. 2016. "AskedValue." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/AskedValue.html.

APA

Wolfram Language. (2016). AskedValue. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/AskedValue.html

BibTeX

@misc{reference.wolfram_2024_askedvalue, author="Wolfram Research", title="{AskedValue}", year="2016", howpublished="\url{https://reference.wolfram.com/language/ref/AskedValue.html}", note=[Accessed: 21-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_askedvalue, organization={Wolfram Research}, title={AskedValue}, year={2016}, url={https://reference.wolfram.com/language/ref/AskedValue.html}, note=[Accessed: 21-November-2024 ]}