WLJS LogoWLJS Notebook

AssociationQ

AssociationQ[expr] gives True if expr is a valid Association object, and False otherwise.

Examples

Test for associations:

AssociationQ[<|"a" -> 1, "b" -> 2|>]
(* True *)
AssociationQ[{"a" -> 1}]
(* False *)

Lists of rules are not associations:

AssociationQ[{a -> 1, b -> 2}]
(* False *)

Please visit the official Wolfram Language Reference for more details.

On this page