remove last item from given collection
Parameters
chop collection :string :literal :pathliteral :block
Attributes
times | :integer | remove multiple items |
Returns
Examples
copy
chop "hellox" ; => "hello"
chop chop "hellox" ; => "hell"
copy
str: "some text"
chop.times:5 str ; => some
chop.times: neg 5 str ; => text
copy
arr: @1..10
chop.times:3 'arr
arr ; => [1 2 3 4 5 6 7]
copy
chop [1 2 3] ; => [1 2]
copy
chop.times:1 [1 2 3] ; => [1 2]
chop.times:2 [1 2 3] ; => [1]
chop.times:3 [1 2 3] ; => []
chop.times:4 [1 2 3] ; => []
copy
chop.times: neg 1 [1 2 3] ; => [2 3]
chop.times: neg 2 [1 2 3] ; => [3]
Related