Restored from previous forum. Originally posted by Grasy.
...parameters like in this example:
Procedure something(param1.l,param2.l,maybe.b="0",standard.s="bla")
Is it possible to predefine values for procedure..
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Kale.
while were on the subject of being lazy
what are your thoughts about this Python-like syntax for procedures:
called like this:
produces:
Hello
I
am
Kale!
in the debug window.
or:
called like this:
produces:
apple : nice
banana : bent
in the debug window.
i may not have thought this through that carefully BTW
--Kale
Getting used to PureBasic and falling in Love!
while were on the subject of being lazy

Code: Select all
procedure printMe(**args)
for x=0 to len(args)
debug str(args(x))
next x
endprocedure
Code: Select all
printMe("Hello", "I", "am", "Kale!")
Hello
I
am
Kale!
in the debug window.
or:
Code: Select all
procedure printMeKwargs(**kwargs)
ResetList(kwargs())
While NextElement(kwargs())
debug str(kwargs()\key)+" : "+str(kwargs()\value)
wend
endprocedure
Code: Select all
printMeKwargs(apple.s="nice", banana.s="bent",)
apple : nice
banana : bent
in the debug window.
i may not have thought this through that carefully BTW

--Kale
Getting used to PureBasic and falling in Love!

-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Kale.
or what about multiple return values?
called like:
text = go()
debug text(0)
debug text(1)
produces:
Hello
Again
in the debug window
--Kale
Getting used to PureBasic and falling in Love!
or what about multiple return values?
Code: Select all
procedure go()
a.s = "Hello"
b.s = "Again"
procedure return a, b
endprocedure
text = go()
debug text(0)
debug text(1)
produces:
Hello
Again
in the debug window

--Kale
Getting used to PureBasic and falling in Love!
