Checking file extensions

I am trying to store file with certain file extensions to list but having some problems.

Here is a part of the code

set fryLst = ""
set fxtLst = ""
foreach f ($AfullNameLst)
  set fname = $f:r
  set fext = $f:e
  if ("$fext" == ".ry") set fryLst = "$fryLst $f"
  if ("$fext" == ".xt") set fxtLst = "$fxtLst $f"
  set fnameLst = "$fnameLst $fname"
  set fextLst = "$fextLst $fext"
end

---------- Post updated at 06:09 PM ---------- Previous update was at 05:58 PM ----------

Fixed it, forgot that
fext did not include the "."

Glad we helped as a sounding board anyway.

replace by CASE statement.

case "$fext" in 
  *.ry ) fryLst="$fryLst $f" ;;
  *.xt ) fxtLst="$fxtLst $f" ;;
  *) commands ';
esac