トップページへ | [ 一覧 | 検索 | 最終更新 ] [ 差分 | 履歴 | 凍結 ] |
IARRAY†形式†
機能†
引数†
返り値†
関連†バージョン†
例†Initializing arrays with IARRAY†_myarray = IARRAY //Initialize _myarray as a general-purpose array _myarray ,= "hoge" //Add some elements... _myarray ,= "hogehoge" _myarray //The array ("hoge","hogehoge") is output If you do not initialize your arrays, there is a common problem you will run into: //If you try it without initializing first... _myarray ,= "hoge" _myarray ,= "hogehoge" _myarray //The array ("","hoge","hogehoge") is output. Note the empty string as the first element. It is important to initialize arrays before adding additional elements to them, to avoid this unwanted empty string element. IARRAY can be used to initialize an array without adding any content to it. Deleting array elements with IARRAY†_myarray = ("hoge","hogehoge") _myarray[0] = IARRAY _myarray //The array ("hogehoge") is output. The first element, "hoge", has been removed, and "hogehoge" has shifted back to fill its spot as the first element. _myarray[0] will output "hogehoge". If instead you try to do this by replacing an array element with an empty string... _myarray = ("hoge","hogehoge") _myarray[0] = "" _myarray //The array ("","hogehoge") is output. The first element, "hoge", has been replaced with an empty string. "hogehoge" has kept its position as the second element. _myarray[0] will output an empty string. If you want to completely delete an element from an array, it is important to use IARRAY so that the element's position is filled in by the other elements of the array. This prevents blank elements, an inflated count of elements, etc. However, if you have an array where the index numbers must not change, then you should not use IARRAY. |
最終更新日: 2023-12-30 (土) 14:54:28
|