SheinScript Programming Language Guide
1. Introduction
SheinScript is a beginner-friendly, Python-inspired programming language created for simplicity and
readability.
Its syntax is clean and easy to learn, making it perfect for students and new developers.
File extension: .ss
Example:
(** Hello World **)
say "Hello, world!"
2. Syntax Basics
- Variables: let x = 10
- Strings: let name = "Shein"
- Input: let name = ask "Enter your name"
- Output: say "Hello " + name
- Comments: (** This is a comment **)
3. Operators
- Arithmetic: +, -, *, /, %, **
- Comparison: ==, !=, >, <, >=, <=
- Logical: and, or, not
Example:
let a = 10
let b = 5
if a > b :: say "A is greater" end
4. Control Flow
- if / elif / else with :: and end
- while loops
- for loops
Example:
if age >= 18 :: say "Adult" else :: say "Minor" end
5. Functions
Use 'func' to define a function.
Example:
func greet(name) ::
say "Hello " + name
end
greet("Shein")
6. Data Structures
- Lists: let items = [1, 2, 3]
- Dictionaries: let person = {"name": "Shein", "age": 16}
- Accessing: items[0], person["name"]
7. Classes & Objects
Example:
class Person ::
func __init__(self, name) :: [Link] = name end
func speak(self) :: say "I am " + [Link] end
end
let p = Person("Shein")
[Link]()
8. File Handling
Example:
let file = open("[Link]", "w")
[Link]("Hello World")
[Link]()
9. Exception Handling
try ::
let result = 10 / 0
catch ::
say "An error occurred"
end
10. Standard Library
- say(), ask()
- len(), append()
- math functions, string methods
- File utilities: open(), read(), write()
11. Modules & Imports
Create reusable code using modules.
Example:
import mymodule
mymodule.say_hi()
12. Advanced Topics
- Recursion
- Closures
- Decorators (future)
- REPL shell usage
13. Tools & Setup
- Use VS Code with .ss syntax highlighter
- CLI: sheinscript [Link]
- Add to PATH for global use
14. Example Projects
1. Calculator
2. Todo List
3. Mini Chatbot
4. Number Guessing Game
15. Cheatsheet
let x = 10
say "Hello"
ask "Enter something"
if ... :: ... end
func name() :: ... end
class ... :: ... end