Author Topic: example DefaultByval1.o2bas needs work  (Read 801 times)

0 Members and 2 Guests are viewing this topic.

jack

  • Guest
example DefaultByval1.o2bas needs work
« on: June 27, 2019, 02:32:57 PM »
the example OxygenBasic\examples\Parameters\DefaultByval1.o2bas needs tidying.
edit, I completely missed the #byval and #byref statements, somehow I thought that they were comments.
Code: [Select]
  #byval

  sub f1(a as long) as long
  '=======================
    int a=4
  end function

  int a=2
  f1 a
  print a



  #byref

  sub f2(a as long) as long
  '=======================
    int a=4
  end function

  int a=2
  f2 a
  print a
« Last Edit: June 27, 2019, 02:51:43 PM by jack »

Charles Pegge

  • Guest
Re: example DefaultByval1.o2bas needs work
« Reply #1 on: June 28, 2019, 09:36:23 AM »
Thanks jack.

Code: [Select]
' #byval #byref for use with Basic-style parameters

  #byval

  sub f1(a as long) as long
  '=======================
    a=4
  end function

  int a=2
  f1 a
  print a



  #byref

  sub f2(a as long) as long
  '=======================
    a=4
  end function

  int a=2
  f2 a
  print a