KeyExistsQ

KeyExistsQ[assoc,key]

returns True if the specified key exists in the association assoc, and False otherwise.

KeyExistsQ[key]

represents an operator form of KeyExistsQ that can be applied to an expression.

Details

  • KeyExistsQ can be applied not only to Association objects, but also to lists of rules.
  • KeyExistsQ[key][expr] is equivalent to KeyExistsQ[expr,key].

Examples

Basic Examples  (2)

Test if a key exists in an association:

Test if a key exists in a list of rules:

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

Text

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

CMS

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

APA

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

BibTeX

@misc{reference.wolfram_2023_keyexistsq, author="Wolfram Research", title="{KeyExistsQ}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/KeyExistsQ.html}", note=[Accessed: 19-March-2024 ]}

BibLaTeX

@online{reference.wolfram_2023_keyexistsq, organization={Wolfram Research}, title={KeyExistsQ}, year={2014}, url={https://reference.wolfram.com/language/ref/KeyExistsQ.html}, note=[Accessed: 19-March-2024 ]}