text
stringlengths
0
897
print "MiniScript is"
for i in range(1, 5)
print "really " * i
end for
print "COOL!"
```
Save this file to disk as "cool.ms" (though the file extension is arbitrary, it's common practice to use ".ms" for MiniScript files). Pay attention to where you save it; you're going to need to know its file path for the next step.
Now the fun part. Open up a new terminal or shell window, or if you are already running command-line MiniScript, enter `exit` (or press control-C) to exit. Now you're back at the shell prompt. As before, enter the path to your command-line MiniScript executable; but before you press Enter or Return, hit the spacebar...
```terminal
$ ./miniscript ~/DailyPurge/cool.ms
MiniScript is
really
really really
really really really
really really really really
really really really really really
COOL!
$
```
The `$` above is my Unix shell prompt; yours will probably be something different, but that's OK. The line `./miniscript ~/DailyPurge/cool.ms` is the Unix command I typed in to launch command-line MiniScript, and give it the path to my *cool.ms* file. MiniScript read that file, executed the code in it, and then exite...
If you see the program output above, then well done! You wrote your very first program in a file, and then ran that program on the command line. Now you have the ability to make your programs as long as they need to be, with the full power of whatever text editor you like, the ability to store them with your backup s...
If you didn't see that output, then let's get to the bottom of it before moving on. If MiniScript didn't launch at all (i.e., you got only an error in response to your command), then you probably got the path to MiniScript incorrect. Review and reproduce the work you did yesterday, until you're able to get command-li...
If it launched, printed its version info, and then immediately exited without printing anything else, then you probably got the path to your *cool.ms* file incorrect. Double-check each part of the path. Remember that Windows uses backslashes (`\\`) to separate each part; Mac and Linux use forward slashes (`/`). Also...
D> You may want to use the `cd` (change directory) shell command to change your current working directory to wherever you stored your *cool.ms* file. Then, after the path to miniscript and a space, you can simply enter *cool.ms*, or the name of any other script in that directory, without having to type the full path.
{pageBreak}
A> **Chapter Review**
A> - You learned how to get a slice of a list or string.
A> - You noticed that lists can be mutated, and found a way to make a copy of a list when you need one.
A> - You created a MiniScript program using a text editor, and ran it using command-line MiniScript.
{gap:340}
{width:"25%"}
![](chinchilla-02.svg)