Waxaan qoraynaa oon dib uhabeyn ku wadnaa docs oo af-soomaali ku qoran, ka qeybqaadasho raac lifaaqaan...Contribution guidelines

Input and Output in Soplang

Input and output operations are fundamental to any programming language. Soplang provides simple and intuitive ways to interact with users through the console and handle file operations.

Basic Output

The qor function is used to display text or values to the console. The name comes from the Somali word "qor" which means "write".

basic_output.sop
// Basic output
qor("Hello, World!")  // Prints: Hello, World!

// Output with variables
door name = "Ahmed"
qor("Welcome, " + name)  // Prints: Welcome, Ahmed

// Output multiple values
door age = 25
qor(name, "is", age, "years old")  // Prints: Ahmed is 25 years old

User Input

The gelin() function is used to read input from the user. It prompts the user for input and returns the entered value as a string.

user_input.sop
// Basic input
door magaca = gelin("Magacaaga qor: ")  // Mohamed
qor("Mahadsanid, " + magaca + "!")  //  Mahadsanid, Mohamed!

// Converting input to numbers
door da = abn(gelin("Da'daada qor: "))  // da' = 10
qor("Sannad kaddib waxaad noqon doontaa " + (da + 1))   // da' = 11