SNOBOL    up
 
  Description: SNOBOL is dynamic typed, garbage-collected and has build-in pattern-matching. Because of the build-in pattern-matching, SNOBOL is suitable for text-manipulation and processing.


  Factorial   SNOBOL4   Michael Neumann
*
* Berechnen der Fakultät
*

* Funktion-Deklaration
      DEFINE("FAC(N)")

* springe zum Start
      :(START)

* Funktions-Implementierung
FAC   FAC = 1
      LE(N, 1)     :S(RETURN)
      FAC = N * FAC(N - 1)
      :(RETURN)


START
      OUTPUT = FAC(6)
END
Calculates the factorial. Results 720.


 Hello World   SNOBOL4   Michael Neumann
*
* die Einrückung ist wichtig!!!
*
      OUTPUT = 'Hello World'
END
Prints "Hello World" onto the screen.


 Squares   SNOBOL4   Michael Neumann
      I = 1
      TXT = ''

LOOP
* wenn I > 10 dann springe nach DONE
      GT(I, 10)       :S(DONE)
      TXT = TXT (I ** 2) ' '
      I = I + 1       :(LOOP)
DONE  OUTPUT = TXT
END
Outputs the squares from 1 to 10.