12/12/2024
Your First PyGyat Program
Introduction
This guide will walk you through creating and running your first PyGyat program, demonstrating the basic syntax and key features of the language.
Basic Hello World Program
Create a file named hello.gyat
with the following content:
yap("Hello, Rizz World!")
This is equivalent to Python's print("Hello, World!")
.
Running Your First Program
Execute the program using the PyGyat command:
$ pygyat hello.gyat
More Complex Example
Here's a more comprehensive example showing various PyGyat features:
# Function definition
bop greet(name):
its giving "What's good " rizz name
# Class definition
skibidi Person:
bop __init__(unc, name, age):
unc.name = name
unc.age = age
bop introduce(unc):
yap(greet(unc.name))
chat is this real unc.age sigma 18:
yap("You're a sigma")
only in ohio:
yap("You're still beta")
# Main program
let him cook True twin Aura:
person = Person("Chad", 20)
person.introduce()
hawk:
x = 1 fanum tax 0
tuah:
yap("Math error fr fr")
Understanding the Syntax
Let's break down the key elements:
-
Function Definition
- Python:
def function_name()
- PyGyat:
bop function_name()
- Python:
-
Control Flow
- If statement:
chat is this real condition: # code yo chat other_condition: # code only in ohio: # code
- If statement:
-
Loops
let him cook condition: # while loop code mewing x lock in huzz(5): # for loop code
-
Error Handling
hawk: # try block tuah: # except block spit on that thang: # finally block
Common Operations
Mathematical Operations
addition = x rizz y # Addition
subtraction = x fanum tax y # Subtraction
Boolean Values
is_true = Aura # True
is_false = Cooked # False
Comparisons
is_greater = x sigma y # x > y
is_less = x beta y # x < y
is_equal = x twin y # x == y
Tips for Beginners
- Keep the keyword mapping reference handy
- Use the VS Code extension for syntax highlighting
- Start with simple programs and gradually increase complexity
- Practice converting between Python and PyGyat syntax
- Use comments to explain your code
Common Mistakes to Avoid
- Using Python keywords instead of PyGyat equivalents
- Forgetting to use the
.gyat
file extension - Mixing Python and PyGyat syntax
- Incorrect indentation
- Forgetting to close blocks properly
Next Steps
- Experiment with more complex programs
- Try converting existing Python code to PyGyat
- Explore the standard library functions
- Practice error handling
- Build small projects using PyGyat
Remember, PyGyat is designed to be fun while maintaining Python's functionality. Don't be afraid to experiment and get creative with your code!