REBOL 3 Docs | Guide | Concepts | Functions | Datatypes | Errors |
TOC < Back Next > | Updated: 18-Feb-2009 Edit History |
If you are using files and URLs, then you are already familiar with the concept of paths. A path provides a set of values that are used to navigate from one point to another. In the case of a file, a path specifies the route through a set of directories to the location of the file. In REBOL, the values in a path are called refinements.
A slash (/) is used to separate words and values in a path, as shown in the following examples of a file path and a URL path:
%source/images/globe.jpg http://www.rebol.com/examples/simple.r
Paths can also be used to select values from blocks, pick characters from strings, access variables in objects, and refine the operation of a function, as shown in the following examples:
USA/CA/Ukiah/size (block selection) names/12 (string position) account/balance (object function) match/any (function option)
The print function in next example shows the simplicity of using a path to access a mini-database created from a few blocks:
towns: [
Hopland [
phone #555-1234
web http://www.hopland.ca.gov
]
Ukiah [
phone #555-4321
web http://www.ukiah.com
email info@ukiah.com
]
]
print towns/ukiah/web
http://www.ukiah.com
TOC < Back Next > | REBOL.com - WIP Wiki | Feedback Admin |