Game Development Reference
In-Depth Information
3. Whenever you use patpUkqS]jpPk@eolh]u in the function definition, it's replaced by the text
that was supplied in the method call's argument. Figure 3-11 illustrates how all this works.
1. Method call:
`eolh]uPatp$Î Ukq_]jsnepa]jupatpukqhegadanaÏ %7
This is the variable's
type. It has to match
the type of information
that the method call sends.
This text is stored
in this variable.
2. Function definition:
bqj_pekj`eolh]uPatp$patpUkqS]jpPk@eolh]u6Opnejc%6rke`
w
pn]_a$patpUkqS]jpPk@eolh]u%7
y
Whenever this variable is used in the method, it's replaced by the text that was
supplied in the method call's argument.
In this example, the Output panel will display “You can write any text you like here!”.
Figure 3-11. Using arguments and parameters
Figure 3-12 shows how you can use this method in a program. You'll find this sample program in the
folder Iapdk`osepdl]n]iapano in the chapter source files.
l]_g]ca
w
eilknpbh]od*`eolh]u*Ikrea?hel 7
lq^he__h]oo I]ej atpaj`oIkrea?hel
w
lq^he_bqj_pekj I]ej$%
w
`eolh]uPatp$ Pdeoeopatpbnkipdaiapdk`_]hh %7
y
bqj_pekj `eolh]uPatp$patpUkqS]jpPk@eolh]u6 Opnejc %6 rke`
w
pn]_a $patpUkqS]jpPk@eolh]u%7
y
y
y
Figure 3-12. Sample program illustrating how arguments and
parameters work
 
Search Nedrilad ::




Custom Search