Default input parameters for functions

Any way to have default input parameters for functions, like I try to do here, setting Depth to 3 by default. I would like to then be able to call the function like this:

GenerateAlphaBetaTree(MyBoard) # uses depth 3

image

1 Like

You just need to add the ? before the parameter name:

GenerateAlphaBetaTree(Board:board,?Depth:int = 3)<sus...
2 Likes

Thx, how would this work when I want to call this function with a different depth value, like 4?

You also need to specify the argument name:

GenerateAlphaBetaTree(MyBoard, ?Depth := 4)
2 Likes