Getting Started with Soplang
Welcome to Soplang! This guide will help you install Soplang, set up your development environment, and write your first Soplang program.
1. Installation
Before you can start programming with Soplang, you need to install it on your system. Choose the installation method that works best for you:
Option 1: Download the Installer
The easiest way to get started is to download the installer for your operating system:
After downloading, run the installer and follow the on-screen instructions.
Option 2: Using Package Managers
You can also install Soplang using package managers:
Using pip (Python Package Manager):
pip install soplang
Using Homebrew (macOS):
brew install soplang
Using apt (Ubuntu/Debian):
sudo apt-get install soplang
For more detailed installation instructions, check out our comprehensive installation guide.
2. Your First Soplang Program
Now that you have Soplang installed, let's write a simple "Hello, World!" program:
# This is a comment
print("Hello, World!")
# Variables
name = "Soplang"
version = 1.2
print(f"Welcome to {name} version {version}!")
# Simple function
def greet(person):
return f"Hello, {person}!"
message = greet("Developer")
print(message)
Save this code in a file named hello.sop
.
Running Your Program
To run your Soplang program, open a terminal or command prompt and navigate to the directory where you saved the file. Then run:
soplang hello.sop
You should see the following output:
Hello, World!
Welcome to Soplang version 1.2!
Hello, Developer!
Congratulations! You've just written and executed your first Soplang program.
3. Basic Concepts
Variables and Data Types
Soplang is dynamically typed, meaning you don't need to declare variable types. The language supports common data types like strings, numbers, booleans, lists, and dictionaries.
# String
name = "Soplang"
# Integer
version = 1
# Float
pi = 3.14159
# Boolean
is_awesome = True
# List
languages = ["Python", "JavaScript", "Soplang"]
# Dictionary
features = {
"syntax": "clean",
"learning_curve": "gentle",
"performance": "excellent"
}
Control Flow
Soplang uses indentation (like Python) to define code blocks in control structures:
# If-else statement
age = 25
if age < 18:
print("You are a minor")
elif age >= 18 and age < 65:
print("You are an adult")
else:
print("You are a senior")
# For loop
for language in ["Python", "JavaScript", "Soplang"]:
print(f"I like {language}")
# While loop
count = 5
while count > 0:
print(count)
count -= 1
print("Blast off!")
Functions
Functions in Soplang are defined using the def
keyword:
# Simple function
def greet(name):
return f"Hello, {name}!"
# Function with default parameter
def power(base, exponent=2):
return base ** exponent
# Function with type hints (optional)
def add(a: int, b: int) -> int:
return a + b
4. Next Steps
Now that you've learned the basics, here are some resources to continue your Soplang journey:
- Language Reference - Comprehensive documentation of Soplang's syntax and features
- Tutorials - Step-by-step guides for common programming tasks
- Community Forums - Connect with other Soplang developers
- Example Projects - Real-world applications built with Soplang
Need Help?
If you encounter any issues or have questions, there are several ways to get help: