Updating parameters in a procedure / function

new topic     » topic index » view thread      » older message » newer message

I want to create a function that adds an element to a sequence, and returns
the index in the sequence. I want it to be flexible, so that it can
update any sequence - but how do I do that?

For example;

atom     idx             idx = 0
sequence myCars          myCars = {}
sequence myPhones        myPhones = {}
sequence myGirlFriends   myGirlFriends = {}

function addElement(sequence Element, sequence mySequence)
  mySequence = append(mySequence, Element)
  return length(mySequence)
end function

idx = addElement("Audi", myCars)
idx = addElement("99 99 99 99", myPhones)
idx = addElement("Trine", myGirlFriends)


Regards,
Kenneth / ZNorQ

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu