a[0] = (name:"Taro" age:15) a[1] = (name:"Jiro" age:12) a[2] = (name:"Sabu" age:10)
>print searchElement(a, "name", 1) (name:"Sabu" age:10) >print searchElement(a, "age", 2) (name:"Taro" age:15)
>print searchIndex(a, "name", 1) 2 >print searchIndex(a, "age", 2) 0
>print searchIndex(a, 1, "name") 0
a[0] = (name:"Taro" age:15 extra:virtualIndex) a[1] = (name:"Jiro" age:12 extra:virtualIndex) a[2] = (name:"Sabu" age:10 extra:virtualIndex)
>print (a[0].extra a[1].extra a[2].extra) (0 1 2)
>a[2].extra = 0 >print (a[0].extra a[1].extra a[2].extra) (1 2 0)
- イメージ - before: a[0] a[1] a[2] after: a[2] a[0] a[1]
a[0] = 1 a[1] = "abc" a[2] = 3.14
コメント | お名前 | NameLink | |