Initial revision
[LeanCalc.git] / help / argv
1 NAME
2     argv - count or value of a calc command line supplied argument
3
4 SYNOPSIS
5     argv([n])
6
7 TYPES
8     n           nonnegative integer
9
10     return      any
11
12 DESCRIPTION
13     Without args, this builtin returns the number of calc command line
14     strings available.
15
16     If the numeric arg is supplied, then the corresponding command line
17     string is return, if it exists.  Otherwise a nul() value is returned.
18
19     In keeping with the argc/argv convention of C, argv(0) will refer
20     to the 1st argv string, and argv(argv()-1) will refer to the last.
21     This differs from the way the param() builtin works.
22
23     By default, calc will evaluate all of its command line arguments.
24     However, if calc is invoked with -s, all non-dashed options will
25     be left as unevaluated strings.  Thus:
26
27         calc -i 2+2
28
29     will cause calc to print 4 and enter interactive mode.  In this case
30     argv() will return 0.
31
32     On the other hand:
33
34         calc -i -s 2+2
35
36     will cause calc to interactive mode.  The argv() builtin will return 1
37     and argv(0) will return the string "2+2".
38
39 EXAMPLE
40     $ calc -s a bb ccc
41     > argc = argv();
42     > for (i = 0; i < argc; i++) print "argv[": i : '] = "': argv(i) : '"';
43     argv[0] = "a"
44     argv[1] = "bb"
45     argv[2] = "ccc"
46
47 LIMITS
48     0 <= n < 2^31
49
50 LINK LIBRARY
51     none
52
53 SEE ALSO
54     param, usage
55