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:

In[1]:=
Click for copyable input
Out[1]=

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

In[2]:=
Click for copyable input
Out[2]=

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

In[1]:=
Click for copyable input
Out[1]=

See Also

AskedQ  Ask  AskDisplay  AskTemplateDisplay  AskState

Introduced in 2016
(10.4)