REBOL 3 Docs Guide Concepts Functions Datatypes Errors
  TOC < Back Next >   Updated: 3-Aug-2010 Edit History  

REBOL 3 Functions: empty?

empty?  series

Returns TRUE if empty or NONE, or for series if index is at or beyond its tail.

Arguments:

series [series! gob! port! bitset! map! none!]

See also:

tail?   none?   found?  

Description

This is a synonym for tail? The check is made relative to the current location in the series.

print empty? []
true
print empty? [1]
false

The empty? function is useful for all types of series. For instance, you can use it to check a string returned from the user:

str: ask "Enter name:"
if empty? str [print "Name is required"]

It is often used in conjunction with trim to remove black spaces from the ends of a string before checking it:

if empty? trim str [print "Name is required"]


  TOC < Back Next > REBOL.com - WIP Wiki Feedback Admin