Author Topic: Passing Optional Parameters  (Read 1281 times)

Offline aroldo

  • Mr. Polyvector
  • ***
  • Posts: 143
    • View Profile
    • APD Consulting, Inc.
Passing Optional Parameters
« on: 2013-Aug-06 »
Is it possible to have optional parameters in FUNCTIONS?


For instance in the example below z may be optional.

Code: GLBasic [Select]
FUNCTION object: x, y, z (as optional)
        .
        .
        .
ENDFUNCTION
[a http://apd-games.com/][img http://apd-games.com/images/APDGames135.png][/a]
MacBook Pro OS X El Capitan
XCode Version 7
iPhone 6 running  iOS 9
iPad Mini running  iOS 7.1
Galaxy S5
Dell Latitude Windows 8 Enterprise
Palm Pre, Palm Pre2

Offline kanonet

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1142
    • View Profile
    • My GLBasic code archiv
Re: Passing Optional Parameters
« Reply #1 on: 2013-Aug-06 »
It is:

Code: GLBasic [Select]
FUNCTION object: x, y, z=3
        .
        .
        .
ENDFUNCTION
Lenovo Thinkpad T430u: Intel i5-3317U, 8GB DDR3, NVidia GeForce 620M, Micron RealSSD C400 @Win7 x64

Offline aroldo

  • Mr. Polyvector
  • ***
  • Posts: 143
    • View Profile
    • APD Consulting, Inc.
Re: Passing Optional Parameters
« Reply #2 on: 2013-Aug-06 »
Thank you
[a http://apd-games.com/][img http://apd-games.com/images/APDGames135.png][/a]
MacBook Pro OS X El Capitan
XCode Version 7
iPhone 6 running  iOS 9
iPad Mini running  iOS 7.1
Galaxy S5
Dell Latitude Windows 8 Enterprise
Palm Pre, Palm Pre2

Offline Emil

  • Mr. Drawsprite
  • **
  • Posts: 64
    • View Profile
Re: Passing Optional Parameters
« Reply #3 on: 2013-Aug-09 »
have been wondering about that for quite some time :)
thanks!