Site Tools


pop_function

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

pop_function [2007/02/17 18:41] (current)
Line 1: Line 1:
 +# $EPIC: pop_function.txt,​v 1.6 2007/02/17 18:41:08 jnelson Exp $
 +======Synopsis:​======
 +$__pop__(<​variable name>)
 +
 +======Technical:​======
 +   * If no arguments are provided, the empty string is returned.
 +   * If the argument consists of only one word, it is taken as <​variable name>.
 +   * If more than one arguments are provided, they are taken as <word list>.
 +   * If a <word list> is provided, the return value is the last word in <word list>​. ​ DOUBLE QUOTED WORDS ARE NOT SUPPORTED. ​ (This may change in the future.)
 +   * If <​variable name> is provided, <​variable name> is changed by removing the last word, and the return value is the word that was removed. ​ DOUBLE QUOTED WORDS ARE NOT SUPPORTED. ​ (This may change in the future.)
 +   * If <​variable name> contains only one word, the entire contents of $<​variable name> are returned and the <​variable name> variable is removed/​unset. ​
 +   * This function does not support double-quoted words.
 +
 +======Practical:​======
 +Pop removes the last word from a word list, or from a word list stored
 +in a variable. ​ It reverses the action of $[[push function|push]](). ​ If you are
 +implementing a FIFO, you can [[unshift function|unshift]] words onto the
 +front of a variable and pop them off the back.
 +
 +======Returns:​======
 +The last word of <word list> or of $<​variable name>.
 +
 +======Examples:​======
 +$pop(one two three) ​                 returns "​three"​
 +assign booya one two three four
 +$pop(booya) ​                         returns "​four",​
 +$booya is now "one two three"​.
 +
 +======History:​======
 +This function first appeared in "​+7"​ (post-ircII,​ pre-EPIC)
  
pop_function.txt ยท Last modified: 2007/02/17 18:41 (external edit)