This language bar is your friend. Select your favorite languages!
list.iter().any(|v| v == &x)
(&list).into_iter().any(|v| v == &x)
with Ada.Containers.Vectors;
Result := Items.Contains (X);
#include <stdbool.h>
bool contains(int x, int* list, size_t list_len) {
    for (int i=0 ; i<list_len ; i++)
        if (list[i] == x)
            return true;
    return false;
List.mem value list
(some #{x} list)
(some (partial = x) list)
#include <algorithm>
std::find_if(list.begin(),list.end(),x) != list.end();
#include <vector>
#include <algorithm>
bool Contains(const std::vector<int> &list, int x)
	return std::find(list.begin(), list.end(), x) != list.end();
import std.algorithm.searching;
bool here = canFind(items, x);
Enum.member?(list, x)
member(_, []) -> false;
member(Value, [H|_]) where Value =:= H -> true;
member(Value, [_|T]) -> member(Value, T).
lists:member(X, List).
member(_, []) -> false;
member(Value, [H|T]) -> 
  case H of
    Value -> true;
    _ -> member(T)
if (findloc (c, x, 1) != 0) then
if (any(x == list)) ...
func Contains(list []T, x T) bool {
	for _, item := range list {
		if item == x {
			return true
	return false
find _ [] = False
find x (x:xs) = True
find x (_:xs) = find x xs
x `elem` list
return list.includes(x);
return list.includes(x) // newer
return list.indexOf(x) !== -1 // older
boolean contains(int[] list, int x){
  for(int y:list)
    if( y==x )
      return true;
  return false;
boolean <T> contains(T[] list, T x){
  if( x==null){
    for(T y:list)
      if( y==null )
        return true;
    for(T y:list)
      if( x.equals(y) )
        return true;
  return false;
import java.util.List;
x in list
(member x list)
function contains(list, x)
	for _, v in pairs(list) do
		if v == x then return true end
	return false
[list containsObject:x];
in_array($x, $list, true);
result := false;
for e in list do 
	if e=x then
			result := true;
uses classes;
result := list.IndexOf(x) <> -1;
# To check an array for a value:
print "Found 'foo'\n" if grep { $_ eq 'foo' } @a_list;

# To check a map for a value:
print "Found 'bar'\n" if exists $map{bar};
List::Util 'first'
print "ok\n" if first {$_ eq 'needle'} @haystack;
member(X, [One]).
x in list
items.include? x
list.include?( x )
val items: Seq[String] = List("a", "b", "c")
(define (contains list x)
        ((null? list) #f)
        ((eq? (car list) x) #t)
        (else (contains (cdr list) x))))
Dim ItemList As New List(Of String)(New String() {"one", "two", "three"})

Do you know the best way to do this in your language ?
New implementation...

Idiom created by

Related idioms