lres is a list of strings to return to the history area. You can use the "@" character to add labels to the
results. Note that the input string lres is stored to the global variable wstr, so that you can also recall
wstr to get the results.
Some examples:
tohome({"45"})
returns
45 : : Stop
tohome({"45","x=6*po"}) returns
45 : x=6*po : : Stop
tohome({"@res1","45","@res2","x=6*po"}) returns
"res1" : 45 : "res2" : x=6*po : : Stop
cj points out that tohome() does not work if called from a keyboard program; those executed with
[DIAMOND][n], where n is a number from 1 to 9. However, tohome() works if kbdprgmn() is called from
the command line.
(Credit to Timité Hassan and cj for Method 2)
[7.9] Passing optional parameters to functions and programs
Many programming languages support passing optional parameters to functions and programs, but TI
BASIC does not. For example, you might have a function f1() that takes three or four parameters:
f
1
(p
1
,p2,p3,p4)
but if the user doesn't supply a value for the third parameter:
f
1
(p
1
,p2,,p4)
then the program supplies a default value for p3, or takes some other action. Note that this feature is
supported in some built-in 89/92+ functions, such as LinReg(), for example.
You can simulate this operation to some extent in your own programs by passing the parameters as
lists. For the example above, the call would be
f
1
(p
1
,p2,{p3},p4)
The p3 parameter is always included in the call, but it may be an emply list. This can be determined if
dim(p3) = 0. There are other variations on this theme, for example
f
1
(p
1
,{p2, p3, p4})
can be used to supply up to three optional parameters. Again dim() is used to determine how many
parameters were supplied.
Alex Astashyn points out that there are some disadvantages to this method:
!
You have to write additional code to recognize which arguments are supplied and to provide
defaults.
!
You have to remember to enter additional arguments in the list.
!
You have to know what the default values are, to decide if you need to change them.
7 - 10
Summary of Contents for TI-92+
Page 52: ...Component side of PCB GraphLink I O connector detail 1 41...
Page 53: ...LCD connector detail PCB switch side 1 42...
Page 54: ...Key pad sheet contact side Key pad sheet key side 1 43...
Page 55: ...Key cap detail 1 44...
Page 57: ...Component side of PCB with shield removed A detail view of the intergrated circuits 1 46...
Page 410: ...void extensionroutine2 void Credit to Bhuvanesh Bhatt 10 4...