Author Topic: function label  (Read 1045 times)

0 Members and 1 Guest are viewing this topic.

José Roca

  • Guest
function label
« on: October 04, 2018, 05:48:59 PM »
Please explain what "label" does as an attribute of function.

Code: [Select]

  '===========================
  'CALLING FUNCTION BY BY NAME
  '===========================

  ' this is okay for short lists of procedures

  function fa() label
  print "A"
  end function

  function fb() label
  print "B"
  end function

  function fc() label
  print "C"
  end function

  sys    FunPtr[3]<=(@fa,@fb,@fc)
  string FunList=" 01 fa 02 fb 03 fc "



  function CallByName(string name)
  '===============================
  sys a,b,pf
  a=instr FunList," "+name+" "
  if a then
    b=val mid FunList, a-2,2
    pf=FunPtr[b]
    call pf
  end if
  end function


  CallByName "fb"

Charles Pegge

  • Guest
Re: function label
« Reply #1 on: October 05, 2018, 12:10:12 AM »
label allows you to reference a function without using its full # signature.

But in this case, it is not necessary because the functions have no parameters and therefore the signature is empty.

José Roca

  • Guest
Re: function label
« Reply #2 on: October 05, 2018, 08:24:01 AM »
And how to use it if they have parameters?