Skip to content
bergsma edited this page Sep 26, 2014 · 3 revisions

#chop

###Chop the last element from a str or list variable.

Syntax

result = chop variable ;

Arguments

  1. list variable

A list or str variable in which the lasted element is chopped.

Return Value

list result
  • element : When the chop function is used in an expression or an assignment, then the return value is the last element from the variable.

The STATUS variable is set to $ACKNOWLEDGE

  • $ACKNOWLEDGE : When the chop function is used as an lvalue - as a statement - then the element chopped - if a variable - will create or overwrite the top-level variable of the same name. The return value is boolean 1, which is discarded on the stack.

The STATUS variable is set to $ACKNOWLEDGE

  • %INVALID : Cannot create variable from parent variable

The STATUS variable is set to %INVALID

  • %BOUNDS : No value to chop from variable

The STATUS variable is set to %BOUNDS

Warnings

  • %INVALID : Cannot create variable from parent variable
  • %BOUNDS : No value to chop from variable

Exceptions

  • %ARGUMENT: Invalid arguments. Usage: result = chop variable ;

  • %IDENTIFIER: 'variable' argument is not a valid identifier, literal, or reference

  • %INVALID: 'argument' is not a list or str variable

Description

  • None

Examples

puts "Create an example for the function 'chop'" ;

Related Links

None

Clone this wiki locally