REXX    hoch
  ähnliche Sprachen: ABC   Amos   BASIC   Euphoria   Profan  
 


 Hello World   Michael Neumann
/* Hello World (Kommentar ist notwendig!!!) */

SAY "Hello World"
Gibt "Hello World" auf dem Bildschirm aus.


 Quicksort   H. Wonner
Quicksort: PROCEDURE expose A.
PARSE ARG lo, hi
/* lo ist der unterste Index, hi ist der oberste Index 
   des zu sortierenden (Teil-)Feldes A. */

/* Aufteilung */

i = lo
j = hi
Pivot = (lo + hi) % 2
x = a.Pivot
Do Until i > j
  Do While a.i < x
    i = i + 1
  end
  Do While a.j > x
    j = j - 1
  end
  if i <= j then do
    h   = a.i
    a.i = a.j
    a.j = h
    i   = i + 1
    j   = j - 1
  end
end

/* Rekursion */

if lo < j then call quicksort lo, j
if i < hi then call quicksort i, hi

Return 0
^Z

Quicksort-Sortieralgorithmus


 Squares (1)   Michael Neumann
/* */

DO I=1 TO 10
   SAY I*I
END
Gibt die Quadrate von 1 bis 10 aus.


 Squares (2)   Michael Neumann
/* */

I=1

DO 10
   SAY I*I
   I = I + 1
END
Gibt die Quadrate von 1 bis 10 aus.