Permalink
Browse files

Added latest array api additions to apidoc.

  • Loading branch information...
1 parent 9680e01 commit d2b471d54b9dac18f83e367f69bde63878cc8d25 @wayneeseguin wayneeseguin committed Nov 11, 2011
Showing with 31 additions and 4 deletions.
  1. +15 −0 bin/array/first
  2. +16 −4 bin/array/last
View
@@ -19,3 +19,18 @@ array print my_array
# one
array first "my_array"
+
+# We can printout the index of the first element:
+# 1
+array first "my_array" index
+
+# Let's declare a string variable
+typeset my_variable
+
+# We can specify to store the first element in a given variable name:
+array first "my_array" as "my_variable"
+
+# This should output:
+# one
+log $my_variable
+
View
@@ -4,7 +4,7 @@ set -v # Turn on verbose logging, so that the following will present a tutorial.
# array(s) module api is loaded with the line 'api/array' in shell/includes.
-# First we declare the my_array variable that we will use, as an array ('-a')
+# last we declare the my_array variable that we will use, as an array ('-a')
typeset -a my_array
# Now we assign five elements into our array.
@@ -16,8 +16,20 @@ my_array=(one two three four five)
array print my_array
-# We can print out the last element of the array to standard out:
-# one
-array last my_array
+# This should print out the last element to standard output:
+# five
+array last "my_array"
+# We can printout the index of the last element:
+# 5
+array last "my_array" index
+# Let's declare a string variable
+typeset my_variable
+
+# We can specify to store the last element in a given variable name:
+array last "my_array" as "my_variable"
+
+# This should output:
+# five
+log $my_variable

0 comments on commit d2b471d

Please sign in to comment.