1510
|
1 |
#!stx --script
|
|
2 |
"/
|
|
3 |
"/ on any system:
|
|
4 |
"/ "stx --script script1.stx
|
|
5 |
"/ or:
|
|
6 |
"/ "stx --f script.stx"
|
|
7 |
"/ or:
|
|
8 |
"/ "stx script1.stx"
|
|
9 |
"/
|
|
10 |
"/ on Unix:
|
|
11 |
"/ make this file executable,
|
|
12 |
"/ ensure that stx is in your path,
|
|
13 |
"/ then type ./script1.stx
|
|
14 |
"/
|
|
15 |
"/ will just print some numbers
|
|
16 |
"/
|
|
17 |
|
|
18 |
"/ Stderr showCR:Workspace workspaceVariableNames.
|
|
19 |
"/ Stderr showCR:Workspace workspaceVariables.
|
|
20 |
|
|
21 |
_$n == 1 ifFalse:[
|
|
22 |
Stderr showCR:('usage: ',_$0,' <n>').
|
|
23 |
Smalltalk exit:1.
|
|
24 |
].
|
|
25 |
|
|
26 |
1 to:(_$1 asInteger) do:[:i |
|
|
27 |
('the factorial of %1 is %2'
|
|
28 |
bindWith:i with:i factorial) printCR
|
|
29 |
].
|