Home   Help Search Login Register  

Author Topic: when to use functions  (Read 589 times)

0 Members and 1 Guest are viewing this topic.

Offline .pablo.

  • Former Staff
  • ****
  • When in doubt, empty the magazine.
when to use functions
« on: 26 Jul 2003, 03:16:36 »
how much code should i have in a script before it is time to shift some of it over to functions?  is it worth creating a function for 2 lines of code that will be used constantly?

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:when to use functions
« Reply #1 on: 26 Jul 2003, 08:07:19 »
Quote
is it worth creating a function for 2 lines of code that will be used constantly?


yes ;)

i personaly dont do it dat much in OFP but in RL wen i program (or learning how 2) usualy i try 2 make lots of functions - nd as lil code as i can ;)  ;D

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline toadlife

  • OFPEC Old Skool
  • Former Staff
  • ****
  • Official OFP Editing Center Toad
    • toadlife.net
Re:when to use functions
« Reply #2 on: 26 Jul 2003, 09:25:00 »
Functions are great for replacing loops in your scripts that process lots of data.

They seem to process data for you faster than loops in scripts.
"Whenever you want information on the 'net, don't ask a question; just post a wrong answer." -- Cancer Omega.