Citrine Playground

Welcome to the Citrine playground. Here you can try Citrine yourself and have some fun with the language. Please be aware that this playground is running on my servers and the code will also be executed on my servers so please be careful.

Run your program:


Example programs

No inspiration ? Why don't you use any of the example programs listed here. I might add even more examples later on. If you have some cool ideas for demo example programs for the playground page, feel free to mail them to me! Here are some example programs you can copy-and-paste into the editor.

Example Program: a simple Hello World

This is a very simple Hello World program just to demonstrate the basic console object called Pen.

Pen write: 'Hello World', brk.

Copy-and-paste into the editor and hit the RUN button to see the result!

Example program: a simple loop

Lets count from 1 to 10 (or 0-9):

1 to: 10 step: 1 do: { :i Pen write: i. }.

or... slightly different:

10 times: { :i Pen write: i. }.

what you do here is you send the times-message or the to-step-do message to a number and that object will take the code block and execute it a number of times.

Example Program: 99 bottles of beer song

This program prints the song 99 bottles of beer.

#99 Bottles of beer song

Number on: 'bottles' do: {
 var phrase := 'no more bottles of beer'.
 var n := me.
 (me = 1) ifTrue: {
  phrase := '1 bottle of beer'.
 (me > 1) ifTrue: {
  phrase := (n + ' bottles of beer').

99 to: 0 step: -1 do: { :i
 Pen write: 
  i bottles +
  ' on the wall, ' + i bottles + '.\n' +
  ((i > 0) either: 
   ('Take one down and pass it around, ' + ((i - 1) bottles) + ' on the wall.\n')
    or: 'Go to the store and buy some more, 99 bottles of beer on the wall.').      

Found any bugs?

Found any bugs? Please report your bugs. Your feedback is essential to develop a programming language like Citrine. Bug reports can help to improve the language and make it more secure and more stable. You can share bug reports on the Google groups forum or mail them to me (gabordemooij at gmail dot com!).

or... go back to homepage