Citrine Programming Language

With Citrine you can easily create apps and games using your native language. You can export your creations to any PC, mobile phone, game console or website. Citrine is Open Source (source). * * Some features are still under development.

Latest News

Citrine ASCII/EN available
Citrine 0.9.6 released
More news »


This website is also served over non-HTTPS.


 

Manual

Citrine is very easy to learn, you create a program by sending messages to objects. There are 3 types of messages: unary (no arguments), binary (one argument) and keyword messages (one or more arguments),
here's how:

☞ x ≔ ‘Hello’ length.
☞ x ≔ 3 + 7.
☞ x ≔ Number between: 0 and: 10.

We use to declare a new variable. In the second example we send a message +7 to 3, the resulting object will be 10. There is no need for if, while or for statements, to execute code conditionally send true: to a boolean, to run code in a loop, multiply the task by sending ×:

(x ≥ y) yes: { ✎ write: ‘buy!’. }.
{ :i ✎ write: i. } × 3.
{ x add: 1. } whilst: { ↲ x < 9. }.

You can write Citrine in your native language, so, for instance, in Dutch, the third example looks like this:

{ x optellen: 1. }
zolang: { ↲ x < 9. }.

There is no special syntax needed for string interpolation, just send a non-defined message to a string to replace the word specified by the message with the argument:

‘Hola señor!’ señor: ‘Don Quijote’.
Hola Don Quijote!

To create your own object, send new to the main Object, you can also use other objects as a prototype. You can add new logic to all objects with on:do:, even existing ones. There are no classes.

Number on: ‘double’ do: { ↲ ⛏ × 2. }.

Note that refers to the object itself. To store a value as an object property use: , properties are only accessible from within the object itself and its derivatives.

☞ cat ≔ Object new.
cat on: ‘name:’ do: { :me
	⚿ name ≔ me.
}.

Apart from a few details, that's basically all there is to it! Now you know Citrine! For more examples, open the learn-by-example manual, which is available for all languages supported by Citrine! * Translated manual available


EXAMPLES (ALL LANGUAGES)

Citrine is a localized scripting language. For some languages, we have to rely on machine translations because we haven't found translators yet. We appreciate any help! All natural languages are welcome**, even if they are not very common (EGIDS-status 6). ** Artificial languages, fantasy languages, private languages and other non-natural languages will not be included but you are free to fork the project of course.
Improve Translations
Also, check the technical FAQ for advanced users (this page is currently available only in English).

 



Want to learn more about Citrine? In our online shop you can buy the official Citrine book. This extensive manual covers all the core concepts as well as advanced Citrine programming techniques. The Citrine book is currently available in English and Dutch.

book


Export your own Citrine creations using our online build server to Android, iOS, Windows, Linux, SteamOS, the web and more!

export