Functions inside Functions, Classes inside Functions

Started by Charles Pegge, February 02, 2025, 04:11:08 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Charles Pegge

More encapsulation:

'FUNCTIONS INSIDE FUNCTIONS
function f1() as int
  function f2() as int
    static int i
    i++
    return i
  end function 'f2
  int j
  j=f2()
  return j
end function 'f1
print f1()
'print f2() 'not found

'CLASSES INSIDE FUNCTIONS
function ff()
  type tt
    float x,y,z
    method mm()
      print "mm"
    end method
  end type
  tt t
  t.mm()
end function
ff()