This arithmetic predicate determines the number of characters of a string or atom. It can be used in arithmetic expressions.
see also: arithmetic in Prolog is/2
| Examples | |
| X is length('hello'). | succeeds, X is 5 |
| X is length("a str") + length("ing"). | succeeds, X is 8 |
| Exceptions | |
| Arg is a variable | an instantiation_error exception is thrown |
| Arg is not a valid atom or string argument | a type_error(evaluable, Arg) exception is thrown |