take

keep firstof elements from given collection and return the remaining ones


Parameters

take collection :string :literal :block :range
     number :integer

Returns

  • :string
  • :block
  • or  :nothing

Examples

copy
str: "some text" take str 4 ; => some take str neg 4 ; => text take 1..3 2 ; => [1 2]

copy
arr: @1..10 take 'arr 3 arr ; => arr: [1 2 3]

copy
take [1 2 3] 3 ; => [1 2 3] take [1 2 3] 4 ; => [1 2 3]

Related