Using a TCLSH (Tool Control Language) scripting language on Cisco devices.
It works the same as the foreach command on PowerShell or Bash shell scripting on Linux.
tclsh
foreach X {
150.40.1.1
150.40.2.2
150.40.3.3
150.40.4.4
4.4.4.4
8.8.8.8
} { ping $X repeat 2 }