1. value parameters only for basic types?

The man says "A copy of the value of each argument is passed in. The formal
parameter variables may be modified inside the procedure but this does not
affect the value of the arguments. "

Is there a way to pass a parameter for a basic type so that the original
(formal) parameter gets altered too?

new topic     » topic index » view message » categorize

2. Re: value parameters only for basic types?

Yes but what you have to do is not pass a variable in through the
procedure/function declaration, but just use a global variable. E.g.

  procedure example(integer var)
     var+=1
  end procedure

Will have no effect, but

  integer var

  procedure example()
      var+=1
  end procedure

  var=1
  example()

Will do the job fine. Of course, there is another way, and that is:

  integer var

  function example(integer var)
    var+=1
    return(var)
  end function

  var=1
  var=example(var)

Hope this helps!

>--- www.spectresoftware.co.uk <---

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu