Hello! I'm Jadss Coder Interpreter, here to help you write and understand Jadss, the easiest programming language in the world. Whether you're creating games, solving math problems, defining functions, working with variables and lists, or much more, Jadss has you covered with its simple and intuitive syntax.
Getting Started with Jadss
1. Variables
Variables store data that can be used and manipulated throughout your program.
let score = 100
let playerName = "Alex"
2. Data Types
- Numbers: Integers and decimals
- Strings: Text enclosed in quotes
- Lists: Ordered collections of items
let age = 25
let pi = 3.14
let colors = ["red", "green", "blue"]
3. Functions
Functions allow you to encapsulate reusable code blocks.
function greet(name) {
print("Hello, " + name + "!")
}
greet("Jordan") // Output: Hello, Jordan!
4. Mathematical Operations
Perform calculations easily using standard operators.
let a = 10
let b = 5
let sum = a + b // 15
let difference = a - b // 5
let product = a * b // 50
let quotient = a / b // 2
5. Control Structures
If-Else Statements
Execute code based on conditions.
let temperature = 30
if temperature > 25 {
print("It's warm outside!")
} else {
print("It's cool outside.")
}
Loops
-
For Loop: Iterate a specific number of times.
for i = 1 to 5 {
print("Iteration " + i)
}
-
While Loop: Continue until a condition is false.
let count = 1
while count <= 3 {
print("Count: " + count)
count = count + 1
}
6. Lists
Manage collections of items easily.
let fruits = ["apple", "banana", "cherry"]
print(fruits[0]) // apple
// Adding an item
fruits.append("date")
// Looping through a list
for fruit in fruits {
print(fruit)
}
7. Game Development Basics
Creating Sprites
Create and manage game objects.
create_sprite("hero", "hero.png")
create_sprite("enemy", "enemy.png")
move_sprite("hero", 100, 200)
move_sprite("enemy", 300, 400)
on_click("hero", function() {
print("Hero clicked!")
})
Basic Game Loop
A simple game loop to update game state.
function game_loop() {
update_game()
render_game()
}
while game_running {
game_loop()
}
Sample Jadss Program: Simple Calculator
Here's a simple calculator program in Jadss that can add, subtract, multiply, and divide two numbers.
function add(a, b) {
return a + b
}
function subtract(a, b) {
return a - b
}
function multiply(a, b) {
return a * b
}
function divide(a, b) {
if b == 0 {
print("Error: Division by zero.")
return null
}
return a / b
}
print("Simple Calculator")
print("Choose an operation: add, subtract, multiply, divide")
let operation = input("Operation: ")
let num1 = input("Enter first number: ")
let num2 = input("Enter second number: ")
if operation == "add" {
let result = add(num1, num2)
print("Result: " + result)
} elif operation == "subtract" {
let result = subtract(num1, num2)
print("Result: " + result)
} elif operation == "multiply" {
let result = multiply(num1, num2)
print("Result: " + result)
} elif operation == "divide" {
let result = divide(num1, num2)
if result != null {
print("Result: " + result)
}
} else {
print("Invalid operation selected.")
}
Creating Your First Game in Jadss
Here's a simple example of how you might start creating a game in Jadss.
// Initialize game
create_sprite("player", "player.png")
create_sprite("enemy", "enemy.png")
set_position("player", 50, 50)
set_position("enemy", 300, 50)
function move_player(direction) {
if direction == "left" {
player.x = player.x - 10
} elif direction == "right" {
player.x = player.x + 10
} elif direction == "up" {
player.y = player.y - 10
} elif direction == "down" {
player.y = player.y + 10
}
}
on_key_press("left", function() {
move_player("left")
})
on_key_press("right", function() {
move_player("right")
})
on_key_press("up", function() {
move_player("up")
})
on_key_press("down", function() {
move_player("down")
})
function game_loop() {
// Game logic goes here
check_collision("player", "enemy")
render_game()
}
while game_running {
game_loop()
}
What's Next?
Feel free to ask me any Jadss-related questions, request assistance with writing specific programs, or seek guidance on more advanced features. Whether you're a beginner or looking to create something more complex, I'm here to help you make the most out of Jadss!
Happy Coding!