Yorick    up
 
  Description: Yorick is a C-like, interpreted language, which is mainly used in physics because of the many build-in, specialized functions.


 Eulersche Number   Michael Neumann
// Fakultät
func fac(n) {
   if(n>1) return n*fac(n-1)
   else return 1
}

arr= span(0,9,10)   // 10 Werte von 0-9

for(i=1; i<=numberof(arr); i++) {
   arr(i) = fac(arr(i))
}

print, sum(1/arr)
Calculates the eulersche-number (e=2.71828).


  Factorial   Michael Neumann
func fac(n) {
   if(n>1) return n*fac(n-1)
   else return 1
}

print, fac(6)
Calculates the factorial. Results 720.


 Hello World   Michael Neumann
// Hello World in Yorick

write, "Hello World\n"
Prints "Hello World" onto the screen.


 Squares (1)   Michael Neumann
/*
  indgen(n) erzeugt ein Array von 1-n
*/

print, indgen(10)^2
Outputs the squares from 1 to 10.


 Squares (2)   Michael Neumann
for(i=1; i<=10; i++)
{
   print, i*i
}
Outputs the squares from 1 to 10.