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 (soon).

Download Citrine Support me on Patreon

Citrine Editor and Demos

 

How does it work?

Citrine thinks in objects. Everything is an object. You create a program by sending messages to these objects. For example, you can send the message length to a text. You will then receive the number of letters as an answer.


‘Hello’ length

So the answer is 5, we can store this under a specific name, for example a. We thus assign the answer to variable a. We do this with and

☞ a ≔ 5. 
☞ b ≔ ‘Hello’.
☞ len ≔ ‘Hello’ length.

Sometimes we send a piece of extra information with a message For example, if we send the message + to a number, we also send the number we want to add. A message can also have multiple pieces of extra information. We separate these with :

☞ x ≔ 3 + 7.
☞ x ≔ Number between: 0 and: 10.

You can create groups with { and }, then it becomes a task. You can repeat such tasks by sending a message like × 10 (do ten times). If you You can also have a task run under a certain condition (x ≥ y)...

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

A task can have parameters. For example, on line 2 you see :i (the iteration), this variable contains the number indicating how many times the task has already been executed (1,2,3).

Suppose you want to replace a part of a text with the contents of a variable. To do so, you simply send the text you want to replace as a message, and the variable that contains the replacement as an extra:

‘abc!’ bc: ‘pp’.
app!

You can also create your own object. You can do so by sending the message new to Object. You may modify any object by adding a new task to it using at:do:.

Number 
on: ‘double’ do: { ↲ ⛏ × 2. }.
 ✎ write: 3 double.
6

Use to send back an answer from a task. represents the object itself. To declare a property of an object, you use: . These properties can only be accessed from a task belonging to the object itself or belonging to a derived object.

☞ cat ≔ Object new.

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

Apart from a few details, that's basically all there is to it! The best way to learn Citrine is just to play with it. Just start the editor and click on the example programs, try to modify them!

Find out what objects and messages you can use in Citrine! Browse the online Citrine dictionary, full of examples!

EXAMPLES (ALL LANGUAGES) Improve Translations

Also, check the technical FAQ for advanced users.

 



Export your own game or app to your phone, PC or game console with the online export module for members!

Due to costs, I can only provide this service if there are at least 30 members. I can create the online building module if there are at least 30 members. Join Citrine!


Export your own creation to Android, iOS, Windows, Linux, macOS, Steamdeck, Nintendo, Playstation, Xbox, Web/HTML5 and more!