Function prototype: Difference between revisions

(Nimrod -> Nim)
Line 473:
proc anyargs(x: varargs[int]): int = echo "anyargs"
proc optargs(a: int, b = 10): int = echo "optargs"</lang>
 
=={{header|Oforth}}==
 
Oforth can only forward declare methods (see Mutual Recursion task). A method can be declared without any class implementation :
<lang Oforth>Method new: myMethod</lang>
 
This creates a new method object with name myMethod (or does nothing if this object already exists). It says nothing about method implementations (number of parameters, return value, ...).
A method object is not directly related to classes :
- A method object is created.
- Classes are created.
- Into classes, you can create implementations for particular methods. If, at this point, the method object does not exist yet, it is created.
 
=={{header|PARI/GP}}==
1,015

edits