Your first program
In this lesson: you will write your first program, run it, and use чоп to show text and numbers on the screen.
Lesson 1
In this lesson: you will write your first program, run it, and use чоп to show text and numbers on the screen.
In this lesson: you will write your first program, run it, and use чоп to show text and numbers on the screen.
A program is a list of commands for the computer. The computer runs them one by one, from top to bottom.
We write and run programs in the playground (майдони озмоиш): https://lindentechde.github.io/Somon-Script/. It opens in the browser, and you do not need to install anything. You write the program on the left. On the right are "Вуруд" ("input") and "Натиҷа" ("output"). The ▶ Иҷро ("Run") button runs the program. The page is in Tajik and Russian.
чоп command1чоп("Салом, ҷаҳон!");
чоп ("print") shows what is inside the brackets in "Натиҷа"."…". In programming, a piece of text is called a string (сатр).;.1чоп("Ман барномасозиро меомӯзам.");2чоп("Ин барномаи аввали ман аст.");3чоп(2026);4чоп(2 + 3);5чоп("2 + 3");
чоп(2 + 3) prints the answer: 5. But чоп("2 + 3") prints the text just as it is: 2 + 3.1чоп("Ҷавоб:", 6 * 7);2чоп("Ман", 13, "сола ҳастам");
Values separated by commas are printed on one line, with a space between them: Ҷавоб: 42.
чоп("Салом);Чоп or chop. Capital and small letters are different: only чоп works.чоп("Салом";If you make a mistake, the playground tells you where it is. In the next lesson, we will learn to read these messages.
Write a program that prints the line Салом, ҷаҳон!.
Input: None.
Output: Салом, ҷаҳон!
Print these three lines exactly:
Ман барномасозиро меомӯзам. Барнома аз фармонҳо иборат аст. Ҳар фармон бо нуқтавергул тамом мешавад.
Input: None.
Output: The three lines above.
Use чоп to draw this picture. The spaces at the start of the lines matter too.
* *** ***** ******* | | |___|
Input: None.
Output: The picture above.