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:

  1. Function Definition

    • Python: def function_name()
    • PyGyat: bop function_name()
  2. Control Flow

    • If statement:
      chat is this real condition:
          # code
      yo chat other_condition:
          # code
      only in ohio:
          # code
      
  3. Loops

    let him cook condition:
        # while loop code
    
    mewing x lock in huzz(5):
        # for loop code
    
  4. 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

  1. Keep the keyword mapping reference handy
  2. Use the VS Code extension for syntax highlighting
  3. Start with simple programs and gradually increase complexity
  4. Practice converting between Python and PyGyat syntax
  5. Use comments to explain your code

Common Mistakes to Avoid

  1. Using Python keywords instead of PyGyat equivalents
  2. Forgetting to use the .gyat file extension
  3. Mixing Python and PyGyat syntax
  4. Incorrect indentation
  5. Forgetting to close blocks properly

Next Steps

  1. Experiment with more complex programs
  2. Try converting existing Python code to PyGyat
  3. Explore the standard library functions
  4. Practice error handling
  5. 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!