以下の関数の目的は、2 つの星の間に引数値を挿入した文字列を返すことです。
star-name: func [name /local stars] [
stars: "**"
insert next stars name
stars
]
print star-name "test" ;*test*
print star-name "this" ;*thistest*, but what I really want is *this*
関数を 2 回目に呼び出すと、最初の呼び出しの引数が挿入されたままになります。答えは を使用することcopy "**"
です。私の質問は、関数が呼び出されるたびにstars
変数を再割り当てしませんか?"**"