[Implemented] Optional/default function parameters

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

[Implemented] Optional/default function parameters

Post by BackupUser »

Restored from previous forum. Originally posted by Hi-Toro.

First of all, thanks again for 3.20 Fred -- tons of cool stuff in there :)

I'd really like something from Blitz, if possible: you can make functions with optional parameters, and you provide default values if they aren't passed. For example...

Function Whatever (x, y, z, a = 999, b = 0, c = 32)
...
End Function

Then I can either supply new values for a, b, c:

Whatever (0, 0, 0, 1, 1, 1)

Or skip them completely to use the defaults:

Whatever (0, 0, 0)

This is so nice to use, and I found that C does it too (I was playing with HiSoft C on WinUAE last night :wink:


--
See ya,
James L Boyd.
http://www.hi-toro.com/
--