Some knowledge of the basic concepts of programming and a bit of experience of any programming language, such as Java, C#, Python, Ruby, or JavaScript, is assumed. To follow along with the examples and exercises, only a minimal install is required, which is discussed in detail in Chapter 2, Setting Up for Development. Practice is the best way to learn a new language. That's why each chapter contains some questions and small exercises to try out your new skills. You'll find the solution in the code files and in the Assessments section.
To get the most out of this book
Download the example code files
You can download the example code files for this book from your account at www.packtpub.com. If you purchased this book elsewhere, you can visit www.packtpub.com/support and register to have the files emailed directly to you.
You can download the code files by following these steps:
- Log in or register at www.packtpub.com.
- Select the SUPPORT tab.
- Click on Code Downloads & Errata.
- Enter the name of the book in the Search box and follow the onscreen instructions.
Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:
- WinRAR/7-Zip for Windows
- Zipeg/iZip/UnRarX for Mac
- 7-Zip/PeaZip for Linux
The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Learn-Red-Fundamentals-of-Red. In case there's an update to the code, it will be updated on the existing GitHub repository.
We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!
Conventions used
There are a number of text conventions used throughout this book.
CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "The console executable is built inside the /home/user/.red folder and is named in the format console-yyyy-m-dd-nnnnn."
A block of code is set as follows:
Red [
Name-Of-Info: "Value of Info"
Name-Of-Info2: "Value of Info2"
...
]
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
a: [1 2 3]
b: copy a
b ;== [1 2 3]
append a 4
a ;== [1 2 3 4]
b ;== [1 2 3]
You can find the code in the codefile that accompanies each section. At the start of each code snippet, you'll see:
;-- see ChapterNN/codefile.red:
This means that this snippet is found in the file ChapterNN/codefile.red in the code download (where NN goes from 01 to 10), as well as the code snippets shown after that, until a new codefile is indicated.
We'll use the terms program, script, app or application as synonyms in this book, because a Red source file can be compiled or interpreted.
We show the return value of a piece of code after ;== like a: 5 ;== 5, because == is how the Red console displays it, and the prefix ; makes it into a comment in scripts.
We have chosen to make all programs immediately runnable in the console without errors. However, certain code is there explicitly to make you see certain errors. These are indicated with a comment: *** Script Error …. Just remove the comment (;) sign at the start of the line to make the error occur.
The same goes for lines staring with #include, just uncomment them in order to compile the program.
Any command-line input or output is written as follows:
$ sudo apt-get update
Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example:
"From the menu, open File | Run."