# for .. in

# Bash

for v in "a" "b" "c" "d" "e"
do
  echo $v
done
for i in `seq 1 5`
do
  echo $i
done

# Bat

for /L %i in (1,1,10) do ( echo %i )

# PowerShell

1..10 | ForEach-Object {
    echo $_
}

# Ruby

for v in ['a', 'b', 'c', 'd', 'e']
  puts v
end

# Swift

for v in items {
  print(v)
}

# TypeScript

for (const v of items) {
  console.log(v);
}

for .. in は 他の言語と異なり取れるのが index なので注意

for (const i in items) {
  console.log(items[i])
}

[ 📩 ご意見 ]