Hi Rodney

>> source f
f: func [a [any-type!]][print "hello"]        ;cut-and-pasted from your
e-mail
>> f
hello
>> f "abc"
hello
>>

Hmm, all of the example from the user guide and your function, F, work fine
on my setup using Viewbeta4.1 on Win98.  What OS are you using?  What is in
your user.r file and other scripts that may have been invoked before the
code in question?

-Larry

----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, June 21, 2000 9:19 AM
Subject: [REBOL] Optional Arguments Working?


> Maybe this has been discussed on the list before
> but if I copy/paste the example in the users-guide
> about how to use optional arguments in a function:
>
> print-vals: func [arg1 arg2 [any-type!]] [
>     print either value? 'arg2 [[arg2 arg1]][arg1]
> ]
>
> print-vals "abc"
> abc
>
> print-vals "abc" 123
> 123 abc
>
> I never get the example results.  If I don't really pass a
> second value to print-vals I get a "Script Error - "abc" has
> no value".  If I try:
>
> f: func [a [any-type!]][print "hello"]
>
> f
>
> Now I get no Script Error but the function never gets called
> ("hello" doesn't print unless I actually pass an arg).
>
> I've tried this with the same results on /Core, /Command, and /View.
>
> What am I doing wrong?
>
> TIA,
>
> Rodney
>

Reply via email to