GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Download
  • News
  • Community
  • Resources
  • Language Reference
  • SmallBASIC Manual

This view

  • Original page
  • New address

GeezerVison is showing smallbasic.github.io — SmallBASIC | FUNC

Edit History

FUNC

FUNC foo (a, b)

Home > Reference > Language

Declares a function. Return a value by assigning a variable with the same name as the function or by using RETURN.

Example 1:

' Main program
print MyAddFunction(10,20)

' Function definition
FUNC MyAddFunction(a,b)
  local c   'c is just known inside this function
  c = a + b
  MyAddFunction = c
END

Example 2: Using return

' Main program
print MyAddFunction(10,20)

' Function definition
FUNC MyAddFunction(a,b)
  local c   'c is just known inside this function
  c = a + b
  return c
END
Code samples using FUNC
000 hello.bas   001 3 ways to print hello 5 times.bas   002 numeric variables.bas   003 conditional branching.bas   004 loops.bas   005 challenge.bas   006 arrays+.bas   100lines.bas   2048.bas   3d_palmx.bas   7gables.bas   agendus.bas   Another center finder.bas   another look at trig functions.bas   B+B.bas   base64.bas   bb2fork smurf.bas   bezier's autograph book.bas   bezierbounce.bas   biorythms.bas   bopit.bas   bowling7.bas   btn 21.bas   calc.bas   Chaos_1xt.bas   checkers.bas   chess.bas   circ.bas   circumscribe triangle.bas  
Language
AND   AS   BAND   BG   BOR   BYREF   CALL   CASE   CATCH   CONST   DECLARE   DEF   DO   ELIF   ELSE   ELSEIF   END   END TRY   ENDIF   EQV   EXIT   FALSE   FI   FOR   FUNC   GOSUB   GOTO   IF   IFF   IMP   IN   LABEL   LET   LIKE   LOCAL   LSHIFT   MDL   MOD   NAND   NEXT   NOR   NOT   ON   OR   REM   REPEAT   RETURN   RSHIFT   SELECT   STEP   STOP   SUB   THEN   THROW   TO   TRUE   TRY   UNTIL   USE   USG   USING   WEND   WHILE   XNOR   XOR  
This page was last edited on Sun, 20 Aug 2023 17:01:26 +0200 | Markdown processed with pandoc 3.1.12.1
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.