(1) How do I create a string array like "first," "second," "third," "fourth"?
Try
string foo[4] = "first", "second", "third", "fourth"
The size of the array must be part of the declaration.
(2) How do I print the whole string? Like if I do
string mycustomarray = "first," "second," "third," "fourth"
How can I use a print command to get
first, second, third, fourth
to appear in the Terminal?
You would have to do it in a loop, e.g.
PHP Formatted Code
for (i
=1; i
<
;= 4; i
=i
+1) {
printf ("%s", foo
[i
])
if (i
<
; 4)
printf (",")
else
printf ("\n")
}
(3) How do I clear the definition of mycustomarray so that I can define it to be something else later, like
mycustomarray = "one," "two," "three," "four"
?
You can't "undeclare" the array, you can simply reuse the elements. Note this means you can't change the size either.
(4) Likewise, how do I clear the definitions of other strings that I create, for example,
string myvariable = "December2014"
and redefine it to be
myvariable = "January2015"
?
Just exactly like that, i.e. you redefine to the value.
(5) Where can I find a tutorial or workshop on how to work with how to set my own IRAF variables? The resources that I located were about parameters within tasks and advanced scripting.
In case you haven't already found it, see the Script Guide at https://iraf.net/irafdocs/script/ as well as the CL Programmer's Manual at
ftp://iraf.noao.edu/iraf/docs/clman.ps.Z