
-----------------------------------
Aange10
Mon Apr 23, 2012 4:44 pm

Adding optional parameters to a procedure
-----------------------------------
Pretty much my qestion is in the title.

I recall reading in the documentation that


proc myProcedure (variableOne : int, 

The above syntax would allow variableOne to be mandatory, and variableTwo to be an optional input. However I get warning (not error) messages when running code like this in my program. Is this incorrect?

-----------------------------------
Tony
Mon Apr 23, 2012 5:33 pm

RE:Adding optional parameters to a procedure
-----------------------------------
you want function overloading
[code]
proc myProc(foo : int, bar : string)
  % do stuff
end myProc

proc myProc(foo : int)
   myProc(foo, "default string")
end myProc
[/code]

-----------------------------------
DemonWasp
Mon Apr 23, 2012 6:22 pm

RE:Adding optional parameters to a procedure
-----------------------------------
Unfortunately, Turing doesn't actually allow either overloading or variable arguments (varargs).

Basically only Turing's original developers get those privileges.
