Skip to content

Writing Code in Sigun

Irem Hatipoglu edited this page May 30, 2023 · 9 revisions

Contents

  1. Start-End Program
  2. Comment Lines
  3. Print an Output
  4. Assignment Operator
  5. Arithmetic Operations
  6. List

Start and End Program

In order to write code in the Sigun programming language, the code block must begin with the word "başla" which means start and then the instructions must be sequenced. Following the completion of the necessary instructions, the code block is ended by using the word "bitir" which means finish in Turkish to signify that the program is complete.

başla
 ...
bitir

Comment Lines

The "***" phrase allows users to place comments between code blocks without any difficulties using comment lines while writing code in the Sigun programming language. By using the three-star symbol specified, one or more lines can be added to the comment line as seen below, according to the user's request.

*** THIS IS
A NOTE ***

Print an Output

In the Sigun programming language, the term "yaz" is used to print an expression, which means the word print in other programming languages that have English syntax. The expression to be printed is provided in parentheses after the "yaz" expression. The sentence is completed with a semicolon once all relevant phrases have been appropriately typed.

 yaz("Merhaba Dünya!");

Assignment Operator

The simplest statement assignment operator in this language uses an indicator for the different data types when initializing. In other words, in the statement a is an Integer as follows:

a = 5;

While in this statement a has a String value when the user writes the assignment operator like this:

a = "5";

Arithmetic Operations

The majority of arithmetic operations in programming languages are written in symbols and are largely universal. Because the Sigun language is primarily intended for young people who are unfamiliar with these existing symbols, utilizing words rather than symbols seems much more understandable when learning from scratch.

  • bölümünden kalan → %
  • veya → ||
  • ve → &&
  • eşit → ==
  • eşit değil → !=
  • doğru/yanlış → boolean(True/False)

While "equal" and "not equal" operations have verbal equivalents, they can also have mathematical symbol equivalents. In other words, the following lines are equal to each other.

b == 30;
b eşit 30;

or

b != 30;
b eşit değil 30;

List

For lists, we used the name "liste". Our lists are able to store more than one type of data and it is dynamic just like python list. This way we are hoping to create a list more like a basket where every type can enter, pop, and be used in different variations of an algorithm. To create a list in the Sigun Programming Language, the keyword "liste" must be written and between the parentheses, the items of that list should be listed as below:

filmler = liste ("Soul", "Sindirella", "Mulan", "Mega Zeka", "Rapunzel", "Moana", "Zootopia", "Arabalar");

If the user would like to create an empty list, it would be enough to just leaving the area between parentheses empty as follows:

deneme = liste ();

Adding new items to lists, deleting elements, specifically reaching an element, reaching the length of the list, updating the list, and emptying the list are all functionalities that could be used in Sigun Programming Language.

First of all, to add an item into the liste users need to write a command that has a structure like "... listesine ... ekle". In the blank spaces, the user should write the name of the list they want to add an item and in the second blank, they need to write the element they would like to add just like in the example below:

*** Adding an element to the list ***
x = "Frozen";
filmler listesine x ekle;

When the user wants to delete a specific item in the list, they need to use the keyword "sil" just like in the example.

*** Removing an item and getting the number of the item in the list ***
silinecek = "Arabalar";
siraNo = filmler listesindeki silinecek elemanının sırası;
filmler listesindeki siraNo. elemanı sil;

To get the length of a previously created list, use the expression "... listesinin uzunluğu" In the blank area in this statement, write the name of the list whose length is to be received.

*** Displaying the length of the list ***
yaz(filmler listesinin uzunluğu);

To entirely clear a previously created and edited list, simply type "temizle" as seen in the example below.

*** Clear the list ***
filmler listesini temizle;
yaz(filmler);
Clone this wiki locally