Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Quick Noob Question
#4
Well, they could display PRINTs of text, but usually you use a SUB for that. Functions receive parameters passed to them and return ONE result normally. I have seen functions return more than one value by using a parameter also.

SUBs can return multiple values and must be called.

A Function can use INPUT, PRINT, etc. It can also fill an array. The Function name returns the value desired. It can pass strings or any type of number.

Code:
FUNCTION Average!(num1%, num2%, num3%)
       sum% = num1% + num2% + num3%
       Average! = sum% / 3
END FUNCTION

PRINT "The average is:"; Average!(one%, two%, tre%)

Ted



Get my QB demonstrator here: http://dl.dropbox.com/u/8440706/Q-Basics.zip
Reply


Messages In This Thread
Quick Noob Question - by wolfturn - 03-16-2009, 09:30 PM
Re: Quick Noob Question - by Clippy - 03-17-2009, 12:07 AM
Re: Quick Noob Question - by wolfturn - 03-17-2009, 06:07 PM
Re: Quick Noob Question - by Clippy - 03-17-2009, 07:30 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)