keyword

keyword <iterable> <word>…

Whether any word produced by an iterable exactly matches (ignoring case) any of the given words.

keyword takes an iterable of strings followed by one or more candidate words. It is true when some word in the iterable equals some candidate, compared case-insensitively. This is the equality-based sibling of abbrev, which matches by prefix instead.

Because a bare string is not iterable, convert one with words first.

Arguments

Returns

A booltrue if any iterable word equals any candidate (case-insensitive), false otherwise.

Examples

after command (say) {
  do "say keyword=[keyword [words 'chat gossip'] hi gossip]."
}

The iterable yields chat and gossip; gossip matches the candidate gossip, so [keyword ...] is true.

after command (say) {
  require [keyword [alias $self] puff dragon]
  do "say Yes, that's one of my names."
}

This guard passes when one of the owner's name aliases is exactly puff or dragon; otherwise the script advances to the next matching handler (see require).

See also