# Categories

This chapter lists the global statements and procedures that form the core of the twinBASIC language.

# Categorical List

## Compiler Control

* [Option](/tB/Core/Option.md) - configure a compiler option
* [#If ... Then ... Else](/tB/Core/Topic-Preprocessor.md) - enable or disable compilation of enclosed code
* [#Const](/tB/Core/Topic-Preprocessor.md) - define a module-private conditional compiler constant

## Declarations and Definitions

* [Class](/tB/Core/Class.md), [Module](/tB/Core/Module.md) - define a class or module
* [Interface](/tB/Core/Interface.md), [CoClass](/tB/Core/CoClass.md) - (twinBASIC) define a COM interface or coclass using twinBASIC syntax
* [Sub](/tB/Core/Sub.md) - define a procedure
* [Function](/tB/Core/Function.md) - define a function
* [Property](/tB/Core/Property.md) - define a property
* [ParamArray](/tB/Core/ParamArray.md) - declare a procedure's final parameter as a variadic argument list
* [Enum](/tB/Core/Enum.md) - define an enumeration type with associated constants
* [Type](/tB/Core/Type.md) - declare a user-defined data type (UDT)/a structure
* [Declare](/tB/Core/Declare.md) - declare an external/library procedure or function
* [Event](/tB/Core/Event.md) - declare an event
* [Implements](/tB/Core/Implements.md) - specifies that a class implements a given interface
* [End](/tB/Core/End.md) - terminate execution, finish a Function, Sub, Property, or Enum definition, finish a Type declaration; finish a Class or Module, finish an If, Select, or With block

## Flow Control

Statements:

* [Call](/tB/Core/Call.md) - invokes a procedure or function
* [Do ... Loop](/tB/Core/Do-Loop.md), [For ... Next](/tB/Core/For-Next.md), [For Each ... Next](/tB/Core/For-Each-Next.md), [While ... Wend](/tB/Core/While-Wend.md) - loops
* [If ... Then ... Else](/tB/Core/If-Then-Else.md) - execute code conditionally
* [Continue](/tB/Core/Continue.md) - skip to the next iteration of the loop
* [Exit](/tB/Core/Exit.md) - exit a loop, procedure, function or property
* [Return](/tB/Core/Return.md) - return from a **GoSub** subroutine, or (twinBASIC) return a value and exit from a **Function** or **Property Get**
* [Select Case](/tB/Core/Select-Case.md) - execute a code block selected by an expression
* [With](/tB/Core/With.md) - bring a variable or expression into scope
* [Goto](/tB/Core/GoTo.md), [GoSub ... Return](/tB/Core/GoSub-Return.md) - transfer execution to another location
* [On ... GoTo](/tB/Core/On-GoTo.md), [On ... GoSub](/tB/Core/On-GoSub.md) - transfer execution to a location selected by an expression
* [Stop](/tB/Core/Stop.md) - interrupt execution

Inline conditional functions --- expression-level alternatives to the **If...Then...Else** and **Select Case** statements above:

* [If](/tB/Modules/Interaction/If.md) - evaluate an expression and return one of two values; only the chosen branch is evaluated (twinBASIC addition)
* [IIf](/tB/Modules/Interaction/IIf.md) - evaluate an expression and return one of two values; both branches are always evaluated
* [Choose](/tB/Modules/Interaction/Choose.md) - return one value from a list, selected by 1-based index
* [Switch](/tB/Modules/Interaction/Switch.md) - return the value paired with the first **True** condition in a list of (condition, value) pairs

See also: 

* [End](/tB/Core/End.md) - terminate execution.
* [On Error](/tB/Core/On-Error.md), [Resume](/tB/Core/Resume.md) - flow control for run-time errors (see [Error Handling](#error-handling))

## Error Handling

Statements:

* [On Error](/tB/Core/On-Error.md) - specifies what to do when an error occurs
* [Resume](/tB/Core/Resume.md) - resumes execution after an error has been caught
* [Error](/tB/Core/Error.md) statement - simulates the occurrence of an error (legacy; prefer **Err.Raise**)

Procedures:

* [Err](/tB/Modules/Information/Err.md) - returns the **ErrObject** describing the current run-time error state
* [Erl](/tB/Modules/Information/Erl.md) - returns the line number where the most recent run-time error occurred
* [Error$, Error](/tB/Modules/Conversion/Error.md) function - returns the error message that corresponds to a given error number
* [CVErr](/tB/Modules/Conversion/CVErr.md) - wraps a numeric expression in a **Variant** of subtype **Error**
* [SetThreadGlobalErrorTrap](/tB/Modules/HiddenModule/SetThreadGlobalErrorTrap.md) - register a callback that fires when an unhandled run-time error escapes the active error handler chain on the calling thread

## Variable Declaration

Statements:

* [Dim](/tB/Core/Dim.md) - declare a typed scalar or array variable
* [Const](/tB/Core/Const.md) - declare a constant
* [Public](/tB/Core/Public.md) - declare a public variable in a class or module
* [Private](/tB/Core/Private.md) - declare a private variable in a class or module
* [Protected](/tB/Core/Protected.md) - (twinBASIC) declare a class member accessible within the class and its derived classes
* [Static](/tB/Core/Static.md) - declare a a variable of static duration

## Variable Assignment and Modification

Statements:

- [Let](/tB/Core/Let.md) - sets the value of a variable
- [Set](/tB/Core/Set.md) - changes the object referred by the variable
- [New](/tB/Core/New.md) - create a new instance of a class
- [LSet](/tB/Core/LSet.md) - assigns a user-defined type, or left-aligns a string
- [RSet](/tB/Core/RSet.md) - right-aligns a string

Operators:

- [Is](/tB/Core/Is.md) - compares two object references for identity
- [IsNot](/tB/Core/IsNot.md) - (twinBASIC) the logical inverse of **Is**

## Arrays

Statements:

* [ReDim](/tB/Core/ReDim.md) - allocate or change the size of a dynamically-sized array
* [Erase](/tB/Core/Erase.md) - fill a fixed-size array with default values, or invalidate a dynamic array

Procedures:

* [LBound](/tB/Modules/Information/LBound.md) - smallest valid subscript for an array dimension
* [UBound](/tB/Modules/Information/UBound.md) - largest valid subscript for an array dimension
* [IsArray](/tB/Modules/Information/IsArray.md) - returns whether a variable is an array
* [IsArrayInitialized](/tB/Modules/Information/IsArrayInitialized.md) - returns whether an array has been dimensioned

See also:

* [Dim](/tB/Core/Dim.md) - allocate a scalar or array variable
* [Array](/tB/Modules/Information/Array.md), [Filter](/tB/Modules/Strings/Filter.md), [Join](/tB/Modules/Strings/Join.md), [Split](/tB/Modules/Strings/Split.md) - array helpers
* [vbaAryMove](/tB/Modules/HiddenModule/vbaAryMove.md), [vbaRefVarAry](/tB/Modules/HiddenModule/vbaRefVarAry.md) - low-level **Variant**-array helpers (see [Memory and Pointers](#memory-and-pointers))

## File I/O

Statements:

- [Open](/tB/Core/Open.md), [Close](/tB/Core/Close.md) - open/close a file for I/O operations
- [Get](/tB/Core/Get.md), [Put](/tB/Core/Put.md) - read/write data from an open random access file
- [Line Input](/tB/Core/Line-Input.md), [Print](/tB/Core/Print.md) - read/write a line from/to an open text file
- [Input](/tB/Core/Input.md), [Write](/tB/Core/Write.md) - read/write data from an open sequential access file
- [Seek](/tB/Modules/FileSystem/Seek.md) - change the current access position in an open file
- [Lock](/tB/Core/Lock.md), [Unlock](/tB/Core/Unlock.md) - lock/unlock a range of records in an open file

Procedures:

* [Reset](/tB/Modules/FileSystem/Reset.md) - close all open disk files
* [Width](/tB/Modules/FileSystem/Width.md) - set the limit for line lengths when printing
* [Input, Input$](/tB/Modules/FileSystem/Input.md) - read a fixed number of characters from a sequential file
* [InputB, InputB$](/tB/Modules/FileSystem/InputB.md) - read a fixed number of bytes from a sequential file
* [ChDir](/tB/Modules/FileSystem/ChDir.md), [ChDrive](/tB/Modules/FileSystem/ChDrive.md) - change the current working directory and disk drive
* [MkDir](/tB/Modules/FileSystem/MkDir.md), [RmDir](/tB/Modules/FileSystem/RmDir.md) - create/remove a directory on disk
* [Name](/tB/Core/Name.md) - rename a file or directory on disk
* [SetAttr](/tB/Modules/FileSystem/SetAttr.md) - set attributes of a file on disk
* [FileCopy](/tB/Modules/FileSystem/FileCopy.md) - copy a file on disk
* [Kill](/tB/Modules/FileSystem/Kill.md) - delete a file from disk
* [SavePicture](/tB/Core/SavePicture.md) - write a `Picture` or `Image` to a disk file
* [MacID](/tB/Modules/Conversion/MacID.md) - convert a 4-character Mac file-type code (legacy)

## State Management
{: index="registry access" }

Procedures:

* [Load](/tB/Core/Load.md), [Unload](/tB/Core/Unload.md) - load/unload a form or control into memory
* [GetSetting](/tB/Modules/Interaction/GetSetting.md), [SaveSetting](/tB/Modules/Interaction/SaveSetting.md) - retrieve/store a string value from/to the system registry
* [GetAllSettings](/tB/Modules/Interaction/GetAllSettings.md) - retrieve every key/value pair in a section of an application's registry entry
* [DeleteSetting](/tB/Modules/Interaction/DeleteSetting.md) - remove value from the system registry

## Events

Statements:

* [RaiseEvent](/tB/Core/RaiseEvent.md) - raise an event that may be handled by event handlers
* [WithEvents](/tB/Core/WithEvents.md) - declare the field through which a module receives another object's events
* [Handles](/tB/Core/Handles.md) - (twinBASIC) bind a procedure as a handler without relying on its name

Procedures:

* [RaiseEventByName](/tB/Modules/Interaction/RaiseEventByName.md) - raise an event by name on an object, taking arguments as a **Variant** array
* [RaiseEventByName2](/tB/Modules/Interaction/RaiseEventByName2.md) - raise an event by name on an object, taking a variable-length argument list
* [RuntimeCreateGetMessageHook](/tB/Modules/HiddenModule/RuntimeCreateGetMessageHook.md) - create an **IGetMessageHook** for filtering Windows messages destined for a window and (optionally) its descendants

See also

* [Event](/tB/Core/Event.md) - declare an event
* [IGetMessageHook interface](/tB/Modules/HiddenModule/index.md#igetmessagehook-interface) - subscribe a callback to a Windows message type, then start/stop delivery

## User Dialogs

Procedures:

* [MsgBox](/tB/Modules/Interaction/MsgBox.md) - display a modal message dialog and return the button the user clicked
* [InputBox](/tB/Modules/Interaction/InputBox.md) - prompt the user for a line of text and return what was entered
* [Beep](/tB/Modules/Interaction/Beep.md) - sound a system beep

## Process Control

Procedures:

* [Shell](/tB/Modules/Interaction/Shell.md) - run another program asynchronously and return its task ID
* [AppActivate](/tB/Modules/Interaction/AppActivate.md) - change the focus to, or activate, a named window
* [SendKeys](/tB/Modules/Interaction/SendKeys.md) - send keystrokes to the active window
* [DoEvents](/tB/Modules/Interaction/DoEvents.md) - yield control to the message loop so pending events can be processed

## COM and Automation

Procedures:

* [CreateObject](/tB/Modules/Interaction/CreateObject.md) - create a new instance of a COM/Automation object
* [GetObject](/tB/Modules/Interaction/GetObject.md) - obtain a reference to an Automation object loaded from a file or already running
* [CallByName](/tB/Modules/Interaction/CallByName.md) - invoke a method or property on an object dynamically by name
* [CallByDispId](/tB/Modules/Interaction/CallByDispId.md) - invoke a method or property on an object dynamically by IDispatch dispatch ID (twinBASIC addition)
* [CreateGUID](/tB/Modules/HiddenModule/CreateGUID.md) - generate a fresh GUID and return it as a string
* [vbaCastObj](/tB/Modules/HiddenModule/vbaCastObj.md) - reinterpret an object as another COM interface (a typed `QueryInterface`)
* [vbaObjSet](/tB/Modules/HiddenModule/vbaObjSet.md), [vbaObjSetAddref](/tB/Modules/HiddenModule/vbaObjSetAddref.md) - assign a raw object pointer to an **Object** variable, with or without addref
* [vbaObjAddref](/tB/Modules/HiddenModule/vbaObjAddref.md) - increment the COM reference count of the object at a given address

See also:

* [ObjPtr](/tB/Modules/Information/ObjPtr.md) - return the COM-identity address of an object (see [Memory and Pointers](#memory-and-pointers))

## Command Line and Environment

Procedures:

* [Command$, Command](/tB/Modules/Interaction/Command.md) - return the command-line arguments passed to the program
* [Environ$, Environ](/tB/Modules/Interaction/Environ.md) - return the value of a process environment variable

## Colours

Procedures:

* [RGB](/tB/Modules/Information/RGB.md) - build an RGB colour value from red, green, and blue components
* [RGBA](/tB/Modules/Information/RGBA.md) - build an RGBA colour value from red, green, blue, and alpha components
* [RGB_R](/tB/Modules/Information/RGB_R.md), [RGB_G](/tB/Modules/Information/RGB_G.md), [RGB_B](/tB/Modules/Information/RGB_B.md), [RGBA_A](/tB/Modules/Information/RGBA_A.md) - extract individual colour components
* [QBColor](/tB/Modules/Information/QBColor.md) - return the RGB colour value for a QuickBASIC colour index
* [TranslateColor](/tB/Modules/Information/TranslateColor.md) - translate an OLE colour value to a plain RGB colour value

## Mathematics

Procedures:

* [Atn](/tB/Modules/Math/Atn.md), [Cos](/tB/Modules/Math/Cos.md), [Sin](/tB/Modules/Math/Sin.md), [Tan](/tB/Modules/Math/Tan.md) - trigonometric functions
* [Sqr](/tB/Modules/Math/Sqr.md) - take a square root
* [Exp](/tB/Modules/Math/Exp.md) - calculate an exponential with base $e$
* [Log](/tB/Modules/Math/Log.md) - calculate the natural (base $e$) logarithm of a number
* [Sgn](/tB/Modules/Math/Sgn.md) - return the sign of a number
* [Abs](/tB/Modules/Math/Abs.md) - returns the absolute value of a number
* [Round](/tB/Modules/Math/Round.md) - round the number to a given number of decimal places
* [Rnd](/tB/Modules/Math/Rnd.md) - generate a random number in the range [0.0, 1.0)
* [ShiftRotateLeft](/tB/Modules/Math/ShiftRotateLeft.md), [ShiftRotateRight](/tB/Modules/Math/ShiftRotateRight.md) - rotate the bits of an integral value
* [ShiftUnsignedRight](/tB/Modules/Math/ShiftUnsignedRight.md) - shift the bits of an integral value right, filling with zeros
* [ByteSwap](/tB/Modules/Math/ByteSwap.md) - reverse the order of the bytes in an integral value
* [Randomize](/tB/Modules/Math/Randomize.md) - seed the random number generator
* [Partition](/tB/Modules/Interaction/Partition.md) - return a string label identifying which of a series of equal-width numeric ranges a value falls into (histogram-style bucketing)

See also:

* [Fix](/tB/Modules/Conversion/Fix.md), [Int](/tB/Modules/Conversion/Int.md) - extract the integer portion of a number
* [CInt](/tB/Modules/Conversion/CInt.md), [CLng](/tB/Modules/Conversion/CLng.md), [CLngLng](/tB/Modules/Conversion/CLngLng.md), [CLngPtr](/tB/Modules/Conversion/CLngPtr.md) - coerce to integer types (rounds half-to-even)

## Type Conversion

Procedures that coerce an expression to a specific type:

* [CBool](/tB/Modules/Conversion/CBool.md), [CByte](/tB/Modules/Conversion/CByte.md), [CCur](/tB/Modules/Conversion/CCur.md), [CDbl](/tB/Modules/Conversion/CDbl.md), [CDec](/tB/Modules/Conversion/CDec.md), [CInt](/tB/Modules/Conversion/CInt.md), [CLng](/tB/Modules/Conversion/CLng.md), [CLngLng](/tB/Modules/Conversion/CLngLng.md), [CLngPtr](/tB/Modules/Conversion/CLngPtr.md), [CSng](/tB/Modules/Conversion/CSng.md) - coerce to a specific numeric type
* [CStr](/tB/Modules/Conversion/CStr.md) - coerce to **String** (locale-aware; preferred over [Str](/tB/Modules/Conversion/Str.md))
* [CVar](/tB/Modules/Conversion/CVar.md) - coerce to **Variant**
* [CDate](/tB/Modules/Conversion/CDate.md) - coerce to **Date**; [CVDate](/tB/Modules/Conversion/CVDate.md) returns a **Variant** of subtype **Date** (legacy)
* [CType](/tB/Modules/Conversion/CType.md) - explicit cast operator with a caller-supplied target type (twinBASIC extension)

Procedures that convert between numbers and strings:

* [Bin$, Bin](/tB/Modules/Conversion/Bin.md) - binary string representation of a number
* [Hex$, Hex](/tB/Modules/Conversion/Hex.md) - hexadecimal string representation of a number
* [Oct$, Oct](/tB/Modules/Conversion/Oct.md) - octal string representation of a number
* [Str$, Str](/tB/Modules/Conversion/Str.md) - decimal string representation of a number
* [Val](/tB/Modules/Conversion/Val.md) - parse a string into a **Double**
* [ValDec](/tB/Modules/Conversion/ValDec.md) - parse a string into a **Decimal**

Procedures that extract the integer portion of a number:

* [Fix](/tB/Modules/Conversion/Fix.md) - truncates toward zero
* [Int](/tB/Modules/Conversion/Int.md) - rounds toward negative infinity

Other:

* [Nz](/tB/Modules/Conversion/Nz.md) - replace **Null** with a default value

See also:

* [Format$, Format](/tB/Modules/Strings/Format.md) - locale-aware number formatting
* [FormatNumber](/tB/Modules/Strings/FormatNumber.md), [FormatPercent](/tB/Modules/Strings/FormatPercent.md), [FormatCurrency](/tB/Modules/Strings/FormatCurrency.md), [FormatDateTime](/tB/Modules/Strings/FormatDateTime.md) - typed formatters
* [CVErr](/tB/Modules/Conversion/CVErr.md), [Error$, Error](/tB/Modules/Conversion/Error.md) function - error helpers (see [Error Handling](#error-handling))

## Type Inspection

Procedures that name or identify a variable's subtype:

* [VarType](/tB/Modules/Information/VarType.md) - returns the **VbVarType** code identifying a variable's subtype
* [TypeName](/tB/Modules/Information/TypeName.md) - returns the name of a variable's data type as a **String**

Procedures that test a value's state or subtype:

* [IsDate](/tB/Modules/Information/IsDate.md) - returns whether an expression can be evaluated as a date
* [IsEmpty](/tB/Modules/Information/IsEmpty.md) - returns whether a **Variant** is uninitialised
* [IsError](/tB/Modules/Information/IsError.md) - returns whether an expression is an error subtype
* [IsMissing](/tB/Modules/Information/IsMissing.md) - returns whether an optional argument was supplied
* [IsNull](/tB/Modules/Information/IsNull.md) - returns whether a variable contains a **Null** value
* [IsNumeric](/tB/Modules/Information/IsNumeric.md) - returns whether an expression can be evaluated as a number
* [IsObject](/tB/Modules/Information/IsObject.md) - returns whether a variable refers to an object

See also:

* [IsArray](/tB/Modules/Information/IsArray.md), [IsArrayInitialized](/tB/Modules/Information/IsArrayInitialized.md) - in [Arrays](#arrays)

## String Handling

Statements that modify strings:

* [Mid =](/tB/Core/Mid-equals.md), [MidB =](/tB/Core/MidB-equals.md) - assign to or replace characters or wide/narrow string sections

Procedures that check properties of strings:

* [Len](/tB/Modules/Strings/Len.md), [LenB](/tB/Modules/Strings/Len.md) - the length of a string
* [Asc](/tB/Modules/Strings/Asc.md), [AscB](/tB/Modules/Strings/Asc.md), [AscW](/tB/Modules/Strings/Asc.md) - returns the character code of the first letter in a string
* [StrComp](/tB/Modules/Strings/StrComp.md) - compares two strings
* [InStr$](/tB/Modules/Strings/InStr.md), [InStrB](/tB/Modules/Strings/InStr.md), [InStr](/tB/Modules/Strings/InStr.md) - finds the position of a given substring in a string

Procedures that create strings:

* [Chr\$](/tB/Modules/Strings/Chr.md), [Chr](/tB/Modules/Strings/Chr.md), [ChrB\$](/tB/Modules/Strings/Chr.md), [ChrB](/tB/Modules/Strings/Chr.md), [ChrW\$](/tB/Modules/Strings/Chr.md), [ChrW](/tB/Modules/Strings/Chr.md) - returns the character having a given code
* [Space$](/tB/Modules/Strings/Space.md), [Space](/tB/Modules/Strings/Space.md) - return a string of spaces
* [String\$](/tB/Modules/Strings/String.md), [String](/tB/Modules/Strings/String.md) - return a string of specified characters

Procedures that return modified strings:

* [Left\$](/tB/Modules/Strings/Left.md), [Left](/tB/Modules/Strings/Left.md), [LeftB$](/tB/Modules/Strings/Left.md), [LeftB](/tB/Modules/Strings/Left.md) - extract a left substring of a string
* [Mid$](/tB/Modules/Strings/Mid.md), [Mid](/tB/Modules/Strings/Mid.md), [MidB\$](/tB/Modules/Strings/Mid.md), [MidB](/tB/Modules/Strings/Mid.md) - extract a substring of a string
* [Right\$](/tB/Modules/Strings/Right.md), [Right](/tB/Modules/Strings/Right.md), [RightB\$](/tB/Modules/Strings/Right.md), [RightB](/tB/Modules/Strings/Right.md) - extract a right substring of a string
* [LTrim\$](/tB/Modules/Strings/LTrim.md), [LTrim](/tB/Modules/Strings/LTrim.md), [RTrim\$](/tB/Modules/Strings/RTrim.md), [RTrim](/tB/Modules/Strings/RTrim.md) - removes leading/trailing spaces from a string
* [Trim$](/tB/Modules/Strings/Trim.md), [Trim](/tB/Modules/Strings/Trim.md) - removes leading and trailing spaces from a string
* [StrReverse](/tB/Modules/Strings/StrReverse.md) - reverses the order of characters of a string
* [LCase\$](/tB/Modules/Strings/LCase.md), [LCase](/tB/Modules/Strings/LCase.md), [UCase\$](/tB/Modules/Strings/UCase.md), [UCase](/tB/Modules/Strings/UCase.md) - capitalizes or lowercases a string
* [StrConv](/tB/Modules/Strings/StrConv.md) - converts the string to a specified format
* [Join](/tB/Modules/Strings/Join.md) - concatenates a string array using a given delimiter
* [Split](/tB/Modules/Strings/Split.md) - splits a string into a string array
* [Replace](/tB/Modules/Strings/Replace.md) - replaces substrings in a string
* [Filter](/tB/Modules/Strings/Filter.md) - filters a string array into a subset according to criteria
* [InStrRev](/tB/Modules/Strings/InStrRev.md) - returns the position of a given substring in a string, searching from the end
* [Format\$](/tB/Modules/Strings/Format.md), [Format](/tB/Modules/Strings/Format.md) - format a numeric expression in a specific way
* [FormatNumber](/tB/Modules/Strings/FormatNumber.md) - formats an expression as a numeric string
* [FormatPercent](/tB/Modules/Strings/FormatPercent.md) - formats an expression as a percent string

Procedures that convert between numbers and strings:

* [Bin$, Bin](/tB/Modules/Conversion/Bin.md) - binary string representation of a number
* [CStr](/tB/Modules/Conversion/CStr.md) - coerce a value to **String** (locale-aware)
* [Hex$, Hex](/tB/Modules/Conversion/Hex.md) - hexadecimal string representation of a number
* [Oct$, Oct](/tB/Modules/Conversion/Oct.md) - octal string representation of a number
* [Str$, Str](/tB/Modules/Conversion/Str.md) - decimal string representation of a number
* [Val](/tB/Modules/Conversion/Val.md) - parse a string into a **Double**
* [ValDec](/tB/Modules/Conversion/ValDec.md) - parse a string into a **Decimal**

See also:

* [FormatCurrency](/tB/Modules/Strings/FormatCurrency.md) - format an expression as a currency string
* [FormatDateTime](/tB/Modules/Strings/FormatDateTime.md) - formats an expression as a date/time string

## Date and Time

Procedures:

* [Date](/tB/Modules/DateTime/Date.md), [Time](/tB/Modules/DateTime/Time.md) - set the current date and time
* [FormatDateTime](/tB/Modules/Strings/FormatDateTime.md) - formats an expression as a date/time string
* [MonthName](/tB/Modules/Strings/MonthName.md) - returns the name of the specified month
* [WeekdayName](/tB/Modules/Strings/WeekdayName.md) - returns the name of the specified day of the week

See also:

* [CDate](/tB/Modules/Conversion/CDate.md), [CVDate](/tB/Modules/Conversion/CVDate.md) - coerce an expression to **Date** or **Variant** (subtype **Date**)

## Introspection

Procedures:

* [CurrentProjectName](/tB/Modules/Compilation/CurrentProjectName.md) - returns the name of the current project
* [CurrentComponentName](/tB/Modules/Compilation/CurrentComponentName.md) - returns the name of the current component (module or class)
* [CurrentComponentCLSID](/tB/Modules/Compilation/CurrentComponentCLSID.md) - returns the Class ID (CLSID) of the current class
* [CurrentProcedureName](/tB/Modules/Compilation/CurrentProcedureName.md) - returns the name of the procedure in which the function is called
* [CurrentSourceFile](/tB/Modules/Compilation/CurrentSourceFile.md) - returns the full path of the current source file
* [ProcessorArchitecture](/tB/Modules/Compilation/ProcessorArchitecture.md) - returns the processor architecture of the running application
* [CompilerVersion](/tB/Modules/Compilation/CompilerVersion.md) - returns the twinBASIC compiler version number
* [UnrollLoop](/tB/Modules/Compilation/UnrollLoop.md) - asks the LLVM compiler to unroll the loop that contains it
* [GetDeclaredTypeProgId](/tB/Modules/HiddenModule/GetDeclaredTypeProgId.md), [GetDeclaredTypeClsid](/tB/Modules/HiddenModule/GetDeclaredTypeClsid.md), [GetDeclaredTypeIid](/tB/Modules/HiddenModule/GetDeclaredTypeIid.md), [GetDeclaredTypeEventIid](/tB/Modules/HiddenModule/GetDeclaredTypeEventIid.md) - return the COM ProgID/CLSID/IID/event IID of a declared type, resolved at compile time
* [GetDeclaredMinEnumValue](/tB/Modules/HiddenModule/GetDeclaredMinEnumValue.md), [GetDeclaredMaxEnumValue](/tB/Modules/HiddenModule/GetDeclaredMaxEnumValue.md) - return the smallest/largest value of a declared enumeration, resolved at compile time

See also:

* [IMEStatus](/tB/Modules/Information/IMEStatus.md) - the current Input Method Editor mode (East Asian Windows only)

## Memory and Pointers

Procedures:

* [ObjPtr](/tB/Modules/Information/ObjPtr.md) - return the COM-identity address of an object
* [StrPtr](/tB/Modules/Information/StrPtr.md) - return the address of the underlying buffer of a **String**
* [VarPtr](/tB/Modules/Information/VarPtr.md) - return the address of a variable
* [AllocMem](/tB/Modules/HiddenModule/AllocMem.md), [FreeMem](/tB/Modules/HiddenModule/FreeMem.md) - allocate/release native memory blocks
* [GetMem1](/tB/Modules/HiddenModule/GetMem1.md), [GetMem2](/tB/Modules/HiddenModule/GetMem2.md), [GetMem4](/tB/Modules/HiddenModule/GetMem4.md), [GetMem8](/tB/Modules/HiddenModule/GetMem8.md), [GetMemPtr](/tB/Modules/HiddenModule/GetMemPtr.md) - read N bytes from a memory address into a typed variable
* [PutMem1](/tB/Modules/HiddenModule/PutMem1.md), [PutMem2](/tB/Modules/HiddenModule/PutMem2.md), [PutMem4](/tB/Modules/HiddenModule/PutMem4.md), [PutMem8](/tB/Modules/HiddenModule/PutMem8.md), [PutMemPtr](/tB/Modules/HiddenModule/PutMemPtr.md) - write a typed value of N bytes to a memory address
* [vbaCopyBytes](/tB/Modules/HiddenModule/vbaCopyBytes.md), [vbaCopyBytesZero](/tB/Modules/HiddenModule/vbaCopyBytesZero.md) - copy a block of bytes; the *Zero* form clears the source after the copy

See also:

* [vbaAryMove](/tB/Modules/HiddenModule/vbaAryMove.md), [vbaRefVarAry](/tB/Modules/HiddenModule/vbaRefVarAry.md) - low-level **Variant**-array helpers (see [Arrays](#arrays))
* [vbaObjSet](/tB/Modules/HiddenModule/vbaObjSet.md), [vbaObjSetAddref](/tB/Modules/HiddenModule/vbaObjSetAddref.md), [vbaObjAddref](/tB/Modules/HiddenModule/vbaObjAddref.md) - object-pointer assignment and refcounting (see [COM and Automation](#com-and-automation))

## Threading and Atomics

Procedures:

* [InterlockedExchangePointer](/tB/Modules/HiddenModule/InterlockedExchangePointer.md) - atomically exchange a pointer-sized value
* [InterlockedCompareExchangePointer](/tB/Modules/HiddenModule/InterlockedCompareExchangePointer.md) - atomically compare-and-swap a pointer-sized value
* [InterlockedCompareExchange32](/tB/Modules/HiddenModule/InterlockedCompareExchange32.md), [InterlockedCompareExchange64](/tB/Modules/HiddenModule/InterlockedCompareExchange64.md) - atomic 32-bit / 64-bit compare-and-swap
* [InterlockedIncrement32](/tB/Modules/HiddenModule/InterlockedIncrement32.md), [InterlockedDecrement32](/tB/Modules/HiddenModule/InterlockedDecrement32.md) - atomic 32-bit increment / decrement

See also:

* [SetThreadGlobalErrorTrap](/tB/Modules/HiddenModule/SetThreadGlobalErrorTrap.md) - per-thread error trap (see [Error Handling](#error-handling))

## Inline Assembly and Codegen

Procedures:

* [Emit](/tB/Modules/HiddenModule/Emit.md) - inject custom **Byte** values into the codegen of the enclosing procedure
* [EmitAny](/tB/Modules/HiddenModule/EmitAny.md) - inject custom typed values into the codegen of the enclosing procedure (size inferred from each value's data type)
* [StackOffset](/tB/Modules/HiddenModule/StackOffset.md) - return the stack-frame offset of a variable, resolved at compile time
* [StackArgsSize](/tB/Modules/HiddenModule/StackArgsSize.md) - return the total size of stack-passed arguments to the enclosing procedure
* [UnprotectedAccess](/tB/Modules/HiddenModule/UnprotectedAccess.md) - return an object reference that bypasses access checks on private members

See also:

* [Direct Assembly Insertion](/Features/Advanced/Assembly.md) - the `Naked` modifier and worked examples

## Expression Evaluation

Procedures:

* [Eval](/tB/Modules/HiddenModule/Eval.md) - compile and evaluate a twinBASIC expression supplied as a string

See also:

* [ExpressionService module](/tB/Modules/TbExpressionService/index.md) - the underlying engine, when more control over binders or compiled-expression reuse is needed

## Financial

Procedures:

* [DDB](/tB/Modules/Financial/DDB.md) - depreciation of an asset via the Double-Declining Balance method
* [FV](/tB/Modules/Financial/FV.md) - future value of an investment with constant deposits and interest
* [Pmt](/tB/Modules/Financial/Pmt.md) - payment for a loan with constant payments and interest
* [IPmt](/tB/Modules/Financial/IPmt.md) - interest payment for a loan with constant payments and interest
* [PPmt](/tB/Modules/Financial/PPmt.md) - principal payment for a loan with constant payments and interest 
* [SYD](/tB/Modules/Financial/SYD.md) - sum-of-years' digits depreciation of an asset
* [SLN](/tB/Modules/Financial/SLN.md) - straight-line depreciation of an asset in one period
* [PV](/tB/Modules/Financial/PV.md) - present value of investment
* [IRR](/tB/Modules/Financial/IRR.md) - internal rate of return for a series of cash flows
* [MIRR](/tB/Modules/Financial/MIRR.md) - modified internal rate of return for a series of cash flow
* [Rate](/tB/Modules/Financial/Rate.md) - interest rate per period of an annuity
* [NPV](/tB/Modules/Financial/NPV.md) - net present value of an investment
* [NPer](/tB/Modules/Financial/NPer.md) - number of periods for an investment with constant deposits and interest
* [FormatCurrency](/tB/Modules/Strings/FormatCurrency.md) - format an expression as a currency string

## Debugging

Methods of the intrinsic [Debug](/tB/Modules/Debug.md) object:

* [Debug.Print](/tB/Modules/Debug.md#print) - write to the [Debug Console](/tB/IDE/Debugging/Debug-Console.md)
* [Debug.TracePrint](/tB/Modules/Debug.md#traceprint) - write to the active trace output, which also works in a compiled executable
* [Debug.Cls](/tB/Modules/Debug.md#cls) - clear the Debug Console
* [Debug.Assert](/tB/Modules/Debug.md#assert) - halt when a condition is **False**

See also

* [Stop](/tB/Core/Stop.md) - suspend execution unconditionally
* [Unit Testing](#unit-testing) - assertions that report results, for tests

## Unit Testing

Modules of the [Assert](/tB/Packages/Assert/index.md) package:

* [Exact](/tB/Packages/Assert/Exact.md) - strictest comparison semantics; datatypes must match and no implicit conversions happen
* [Strict](/tB/Packages/Assert/Strict.md) - case-sensitive strings, otherwise standard twinBASIC equality
* [Permissive](/tB/Packages/Assert/Permissive.md) - case-insensitive strings, otherwise standard twinBASIC equality

Each module exposes the same fifteen assertions: **Succeed**, **Fail**, **Inconclusive**, **AreEqual** / **AreNotEqual**, **AreSame** / **AreNotSame**, **IsTrue** / **IsFalse**, **IsNothing** / **IsNotNothing**, **IsNull** / **IsNotNull**, **SequenceEquals** / **NotSequenceEquals**. All are tagged `[DebugOnly(True)]` and compile out of release builds.

## Deprecated

Statements:

* [DefBool, DefByte, DefInt, DefLng, DefCur, DefSng, DefDbl, DefDec, DefDate, DefStr, DefObj, DefVar](/tB/Core/Deftype.md) - used to give implicit types to single-letter variables

