Skip to content

Variables and Data Types

andydhancock edited this page Nov 16, 2023 · 1 revision

Variables and Data Types

In LegaleseScript, variables are used to represent the elements of a contract, such as the parties involved, the numerical values like dates and monetary amounts, and textual information. The language provides several data types designed to accurately represent legal concepts.

Variables

A variable in LegaleseScript is a symbolic name associated with a value and whose data type is defined. Variables are declared with a specific type and an identifier, and they can be reassigned if necessary.

Declaration and Assignment

Text contractTitle = "Employment Agreement";
Number interestRate = 5.0;
Currency penaltyFee = Currency("GBP", 150.00);

Mutable Variables

Variables in LegaleseScript are mutable, meaning that their values can change throughout the contract.

// Reassigning a variable
contractTitle = "Updated Employment Agreement";

Data Types

LegaleseScript introduces a variety of data types tailored for legal documentation:

Text

Text is used for string values, typically for non-numeric contract elements like names, titles, or descriptions.

Text confidentialityClause = "The Employee agrees to maintain confidentiality...";

Number

Number is a flexible data type that can represent both whole numbers and numbers with fractions.

Number totalShares = 1000;

WholeNumber

WholeNumber is used for integers and is helpful when dealing with counts, such as the number of shares or employees.

WholeNumber numberOfEmployees = 50;

FractionalNumber

FractionalNumber represents a number that can have a fractional component. It is specified with a minimum fraction to indicate the smallest unit of division allowed.

// Here, leave can be taken in quarter-day increments
FractionalNumber(0.25) leaveDays = FractionalNumber(0, 0.25);

Currency

Currency is a specialized type for monetary values, ensuring correct handling of currency-related operations.

Currency annualSalary = Currency("USD", 60000);

Date

Date is used for date values and is essential for representing dates within a contract.

Date contractStartDate = Date("2023-01-01");

Duration

Duration represents a length of time, which could be in days, months, or years.

Duration probationPeriod = Duration("Months", 6);

Party

Party represents an entity or person who is a party to the contract.

Party employer = "Acme Corporation";
Party employee = "John Doe";

Custom Types

LegaleseScript also supports the creation of custom types to represent complex contract elements. This allows for extending the language to suit specific legal needs.

// Custom type declaration (hypothetical example)
type LeaseTerm {
    Date startDate;
    Date endDate;
    Currency monthlyRent;
}

Each data type is designed with legal use cases in mind, ensuring that contracts written in LegaleseScript are both precise and clear. Further details and use cases for each data type will be provided in subsequent sections of the documentation.

Clone this wiki locally