一維陣列 one-dimensional array
C
int a[3]={1,2,3};
char *b[]={"abc", "def", "ghi"};
printf("%d", a[0]);
printf("%s", b[1]);
javascript
var a=[1,2,3];
var b=["abc", "def", "ghi"];
console.log(a[0]);
console.log(b[1]);
PHP
$a=array(1,2,3);
$b=array("abc", "def", "ghi");
echo $a[0];
echo $b[1];
Lua
a={1,2,3}
b={"abc", "def", "ghi"}
print(a[1])
print(b[2])
Python
a=[1, 2, 3]
b=["abc", "def", "ghi"]
print(a[0])
print(b[1])
bash
a=(1 2 3)
b=(abc def ghi)
echo ${a[0]}
echo ${b[0]}
declare -a b=(1 2 3)
declare -a b=("abc" "def" "ghi")
echo ${a[0]}
echo ${b[0]}