Linux bash for loop shell script example

Write a code using loops in Linux shell script to derive following pattern.

a Nix
b Craft
c Nix
d Craft
e Nix
f Craft

Try bash for loop as follows:

#!/bin/bash
c=0
var=""
for i in a b c d e f
do
        # find odd or even number
	rem=$(( $c % 2 ))
        # for every even number display "nix" else show "Craft" #
	[ $rem -eq 0 ] && var="nix" || var="Craft"
	echo "$i $var"
        # increase counter 
	(( c++ ))
done

#!/bin/bash

for i in {a…f} ;do
[ “$var” = Nix ] && var=Craft || var=Nix
echo $i $var
done