Keywords Reference

Complete guide to all keywords and built-in functions supported by LangPy in Spanish

Introduction

LangPy translates Python keywords to other languages maintaining 100% compatibility. All keywords are case-sensitive, just like standard Python. This reference uses Spanish as the example language.

Only keywords are translated - variable names, strings, comments, and library APIs remain unchanged

Control Flow

Conditionals, loops, and execution control

si / if

Evaluates boolean conditions to execute code blocks

sino / else

Defines the alternative block when the condition is false

sisi / elif

Allows chaining additional conditions

mientras / while

Repeats a block while the condition is true

para / for

Iterates over sequences or iterables

romper / break

Terminates the current loop immediately

continuar / continue

Skips to the next iteration of the loop

retornar / return

Returns a value from a function

pasar / pass

Placeholder that performs no operation

Pattern Matching

Match/case for pattern matching (Python 3.10+)

segun / match

Initiates a pattern matching structure

caso / case

Defines a pattern to match within match

Requires Python 3.10 or higher

Logical Operators

Boolean and membership operators

y / and

Logical AND operator - true if both conditions are true

o / or

Logical OR operator - true if at least one condition is true

no / not

Logical NOT operator - inverts the boolean value

en / in

Checks if an element is present in a sequence

Structure Definition

Functions and classes

definir / def

Defines a function or method

clase / class

Defines a class for object-oriented programming

Context Management

Context managers with with/as

con / with

Creates a context for automatic resource management

como / as

Assigns an alias or captures the result of a context manager

Exception Handling

Try/except for error catching and handling

intentar / try

Initiates a code block that may raise exceptions

excepto / except

Catches and handles specific exceptions

finalmente / finally

Defines code that always executes, with or without exception

lanzar / raise

Raises an exception manually

Excepcion / Exception

Base class for all built-in exceptions

Imports

Module and package importing

importar / import

Imports a complete module

desde / from

Imports specific elements from a module

Built-in Functions

Commonly used built-in functions

imprimir / print

Displays values to standard output

longitud / len

Returns the number of elements in a sequence

tipo / type

Returns the type of an object

rango / range

Generates a sequence of numbers

entrada / input

Reads user input from the console

borrar / del

Deletes variables or objects from memory

Other Python built-in functions (map, filter, zip, etc.) are used with their original English names

Type Conversion

Casting functions for primitive types

texto / str

Converts a value to a text string

entero / int

Converts a value to an integer number

decimal / float

Converts a value to a floating-point decimal number

booleano / bool

Converts a value to boolean type (Verdadero/Falso)

Literal Values

Boolean constants and None

Verdadero / True

Boolean true value

Falso / False

Boolean false value

Ninguno / None

Represents the absence of value

These values must be written with the first letter capitalized (case-sensitive)

Variable Scope

Global variable declaration

global / global

Declares that a variable belongs to the global scope