default values of function arguments

new topic     » topic index » view thread      » older message » newer message

------=_NextPart_000_001F_01BF94FB.1C2433E0
        charset="iso-8859-2"
Content-Transfer-Encoding: quoted-printable

1.
how can I define default value of argument in function/procedure?
in C it can be done like this,with prototype: func(arg1,arg2=3D34)
it would be really really useful, so you wouldn't have to write each =
time
all arguments, but just some.
This would be very useful:
func(arg1,,arg3)
just second argument would then use its default value, third can be =
normal(not like in C).

i know that you can do this:
if arg2=3D0 then
    arg2=3D34
end if
or sometin like that,
but is there a better way, quicker?

2.
It's dumb that you HAVE to get return value of every function.
Sometimes you need return value, sometimes not, if you dont have time to
check for errors.
Is there a way to use function return values as in C?



------=_NextPart_000_001F_01BF94FB.1C2433E0
        charset="iso-8859-2"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-2" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3401" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>1.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>how can&nbsp;I define default value of =
argument in=20
function/procedure?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>in&nbsp;C it can be done&nbsp;like =
this,with=20
prototype: func(arg1,arg2=3D34)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>it would be really really useful, so =
you wouldn't=20
have to write each time</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>all arguments, but just =
some.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT><FONT face=3DArial size=3D2>This =
would be very=20
useful:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>func(arg1,,arg3)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>just second argument would then use its =
default=20
value, third can be normal(not like in C).</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>i know that you can do =
this:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>if arg2=3D0 then</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; =
arg2=3D34</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>end if</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>or sometin like that,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>but is there a better way, =
quicker?</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>2.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>It's dumb that you&nbsp;HAVE =
to&nbsp;get return=20
value of every function.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Sometimes you need return value, =
sometimes not, if=20
you dont have time to</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>check for errors.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Is there a way to use function return =
values as in=20
C?</FONT></DIV>
<DIV>&nbsp;</DIV>

------=_NextPart_000_001F_01BF94FB.1C2433E0--

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu