12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- # Standard Arrays
- let array = [1 [2 3] 4 [5 6]]
- for i in @array
- echo $i
- end
- for i in [1 [2 3] 4 [5 6]]
- echo $i
- end
- # Array Command Substitution
- let array_process = [ @(echo a b c d e) ]
- for i in @array_process
- echo $i
- end
- for i in @(echo a b c d e)
- echo $i
- end
- # Array Concatenation
- let new_array = [@array @array_process]
- for i in @new_array
- echo $i
- end
- # As Command Arguments
- echo @array
- echo @array_process
- echo @new_array
- # Slice by ID
- let array = [ 1 2 3 ]
- echo @array[0]
- echo @array[1]
- echo @array[2]
- echo [ 1 2 3 ][0]
- echo [ 1 2 3 ][1]
- echo [ 1 2 3 ][2]
- echo @(echo 1 2 3)[0]
- echo @(echo 1 2 3)[1]
- echo @(echo 1 2 3)[2]
- # Slice by Range
- let array = [ 1 2 3 4 5 ]
- echo @array[0..1]
- echo @array[0...1]
- echo @array[..3]
- echo @array[3..]
- echo @array[..]
- # Slice Syntax w/ variables
- for index in 0..3
- echo $(echo 😉😉😉)[$index]
- end
- # Convert Array to String
- let array = [ 1 2 3 4 5 ]
- let as_string = @array
- echo $as_string
|