In an interactive environment, REBOL is not required.
The interpreter can see the result immediately when it does anything.
An error is reported immediately. The four examples here are the error messages that are received due to different causes of program errors.
• The first error message is access error, which indicates "not found" (not found ). Link
A nonexistent website, of course, cannot retrieve the webpage, So you receive such an error warning.
• The second error message is still "Access Error", which is "timeout" (network connection timeout ).
• The third error message is syntax error, indicating a syntax error. We make a mess in the interaction environment, which does not match
Syntax, So you receive such an error warning.
• The fourth error message is math error, indicating a mathematical error. When I was in elementary school, we knew we could not get 0.
Divisor,
So I receive such an error warning.
We are REBOL.
Beginners of the language often see error messages at the beginning. This is a natural issue. Don't feel frustrated.
With
The language is getting increasingly familiar, and the probability of an error is getting smaller.
The error message contains some useful information. We can often use this information to troubleshoot the error and modify the program. To
Don't be afraid to see the error information. They actually help us.
18
1st programming principles
As long as REBOL
Once the interpreter is disabled, the previous history will disappear, and the next time it is a brand new start. If you want
Keep your operation records (with the output records on the Interface). You can use echo
Function. Specify a file after Echo.
In the example, save the record to history.txt. If you do not specify the file path, the file will be placed
In the current directory. When you want to stop recording interface output, the command line you should input is echo off.
What should I enter now? Casual play:
111 first enter old-Dir: What-Dir (REBOL is case-insensitive) to obtain the current directory path,
And record it in the old-Dir
.
222 then input ls to get all the files in the current directory. I like
Write in upper case, not lower case, because
L is accidentally regarded as number 1. Ls
Lists all objects in the current directory.
You will see a file named history.txt.
File.
333 enter CD... (note that there is a space behind CD), and let the REBOL interpreter switch the current directory to the previous layer.
... Is the meaning of the last directory ,.
Is the meaning of the current directory.
444 enter what-Dir to confirm that the directory has been moved up.
555 enter the LS again and you will find that the listed file list is different from the one just now.
19
Chapter 4 Use the interactive environment
666 switch the directory back to the previous directory through CD: old-Dir.
777 echo off
Disable the record function.
888 print to-stringread into history.txt, we can call up the previously recorded content
Let's see.
The operations we have practiced here are all for the file system. REBOL
Is a good tool to help me
Manage files.
In addition to file-related operations
It also provides many operations, and you can see all function functions through what function.
20
1st programming principles
After having a basic understanding of the interactive environment, let's solve practical problems. After we get a program proposition,
First, we should consider how to solve this problem. If the problem is too big, we need to break it down and then merge it.
If the problem persists, continue to resolve it until it can be solved.
This article is excerpted from "programming ing: everyone can learn programming ".
Dr. Cai
Published by Electronic Industry Publishing House
Book details: http://blog.csdn.net/broadview2006/article/details/7768124