i am trying to check if a element is present in an array using plpgsql.

and i am receiving "array subscript must have integer" error while executing the function.

select test('IND') should return true and select test('ING') should return false

Below is the code

```
create or replace function test(country varchar) 
returns varchar
language plpgsql
AS $function$
declare
   results varchar;
   countryarr varchar[3];
   i varchar[];
begin  
   countryarr := array['IND','USA','MEX'];

   foreach i slice 1 in array countryarr
    loop
      if countryarr[i]=country
         then results := 'TRUE';
      else
          results := 'FALSE';
      end if;
    end loop;

   return results;
 end;
 $function$
 ;

```