Diferencia entre revisiones de «Gambas/Referencia Rápida»

Contenido eliminado Contenido añadido
Página creada con 'Nota: Falta traducir algunas partes al español '''Data Types''' Boolean True or false Byte 0 to 255 Short -32.768 to +32.767 Integer -2.147.483.648 to +2.147.483.647 Long -9…'
 
Sin resumen de edición
Línea 2:
 
'''Data Types'''
*Boolean True or false
*Byte 0 to 255
*Short -32.768 to +32.767
*Integer -2.147.483.648 to +2.147.483.647
*Long -9.223.372.036.854.775.808 to +9.223.372.036.854.775.807
*Single Like the float datatype in C.
*Float Like the double datatype in C.
*Date Date and time, each stored in an integer.
*String A variable length string of characters.
*Variant Any datatype.
*Object Anonymous reference to any object.
*Pointer A memory address.
 
'''Comments'''
Línea 19:
 
'''Variable Declaration'''
 
[STATIC] {PUBLIC|PRIVATE} Identifier [Static array declaration] AS Datatype [=Expression]
STATIC PUBLIC GridX AS Integer
Línea 40 ⟶ 41:
 
'''Class Declaration'''
 
[STATIC] {PUBLIC|PRIVATE} Identifier AS NEW Class (Arguments...)
STATIC PRIVATE Tasks AS NEW List
Línea 45 ⟶ 47:
 
'''Constant Declaration'''
 
{PUBLIC|PRIVATE} CONST Identifier AS Datatype = Constant value
'Constant datatype can be: Boolean, Integer, Long, Float or String.
PUBLIC CONST MAX_FILE AS Integer = 30
PRIVATE CONST DEBUG AS Boolean = TRUE
PRIVATE CONST MAGIC_HEADER AS String = "# Gambas form file"
 
'''Assignment'''
Línea 59 ⟶ 62:
 
'''Loop Control Structures'''
 
FOR Variable = Expression TO Expression [STEP Expression]
...
Línea 109 ⟶ 113:
 
'''Test Control Structures & Functions'''
 
Value = Choose (Choice, Result1, Result2 [, ... ])
X = 3
Línea 160 ⟶ 165:
 
'''Arithmetic Operators'''
A = Number + Number 'Adds two numbers
A =- Number 'Computes the opposite sign of a number. Zero is the opposite of itself
A = Number – Number 'Subtracts two numbers
A = Number * Number 'Multiplies two numbers
A = Number / Number 'Divides two numbers. A Division By Zero (#26) error will occur if the value of the number to the right of the slash is zero
A = Number ^ Power 'Raises Number to the power Power.
A = Number \ Number
A = Number DIV Number 'Computes the quotient of the two Integer numbers, truncating the result. A Division By Zero (#26) error will occur if the value of the number to the right of the backslash is zero
A = Number MOD Number 'Computes the remainder of the quotient of the two numbers. A Division By Zero (#26) error will occur if the value of the number to the right of the operator MOD is zero
 
'''Comparison Operators'''
Number = Number 'Returns TRUE if two numbers are equal
Number <> Number 'Returns TRUE if two numbers are different
Number1 < Number2 'Returns TRUE if Number1 is strictly lower than Number2
Number1 > Number2 'Returns TRUE if Number1 is strictly greater than Number2
Number1 <= Number2 'Returns TRUE if Number1 is lower or equal than Number2
Number1 >= Number2 'Returns TRUE if Number1 is greater or equal than Number2
'If the result of a Comparison is assigned to an integer variable, then the result is either -1 (True) or 0 (False)
 
'''Assignment Operators'''
Variable = Expression 'Direct assignment
Variable += Expression 'Assignment with addition. This is a synonymous for Variable = Variable + Expression
Variable -= Expression 'Assignment with substraction. This is a synonymous for Variable = Variable - Expression
Variable *= Expression 'Assignment with multiplication. This is a synonymous for Variable = Variable * Expression
Variable /= Expression 'Assignment with division. This is a synonymous for Variable = Variable / Expression
Variable \= Expression 'Assignment with integer division.This is a synonymous for Variable = Variable \ Expression
Variable &= Expression 'Assignment with string concatenation. This is a synonymous for Variable = Variable & Expression
Variable &/= Expression 'Assignment with path concatenation. This is a synonymous for Variable = Variable &/ Expression
 
'''Method Declaration'''
 
''Procedures''
 
[STATIC] {PUBLIC|PRIVATE} {PROCEDURE|SUB}
Identifier
Línea 204 ⟶ 211:
 
''Functions''
 
[STATIC] {PUBLIC|PRIVATE} {FUNCTION|PROCEDURE|SUB}
Identifier
Línea 219 ⟶ 227:
 
'''Error Management'''
 
*DEBUG Prints a debugging message.
FINALLY Executes a block of code in a function, even if there was an error.
CATCH*FINALLY CatchesExecutes ana errorblock of code in a function, even if there was an error.
*CATCH Catches an error in a function.
*Error The Error static class.
TRY Tries to execute a statement, without raising an error.
*TRY Tries to execute a statement, without raising an error.
*ERROR Returns if an error happened, or prints an error message. Returns TRUE if an error has happened. Use it just after a TRY instruction to know if the executed instructions failed.
'Prints a file to the screen
SUB PrintFile(FileName AS STRING)
Línea 242 ⟶ 251:
'''Functions'''
''String Functions''
*Asc Returns the ASCII code of a character in a string.
*Chr$ Returns a character from its ASCII code.
*Comp Compares two strings.
*InStr Searches a string into another string.
*LCase$ Converts a string to lowercase.
*Left$ Returns the first characters of a string.
*Len Returns the length of a string.
*LTrim$ Strips white spaces from the left of a string.
*Mid$ Returns a part of a string.
*Replace$ Replaces in a string a substring by another one.
*Right$ Returns the last characters of a string.
*RInStr Searches a string into another string from its right.
*RTrim$ Strips white spaces from the right of a string.
*Scan Splits a string against a regular expression pattern.
*Space$ Returns a string containing only space.
*Split Splits a string into substrings.
*String$ Returns the same string concatenated many times.
*Subst$ Substitutes strings in a pattern.
*Trim$ Strips white spaces from a string.
*UCase$ Converts a string to uppercase.
 
''Stream & Input/Output functions''
*CLOSE Closes a stream
*Eof Returns if the end of file is reached.
ERROR Prints expressions to the error standard output.
*ERROR TO RedirectsPrints theexpressions standardto the error standard output.
INPUT*ERROR FROMTO Redirects the standard inputerror output.
*FLUSH Flushes the output of a buffered stream.
*INPUT Reads strings from a text stream and converts them into values.
INPUT FROM Redirects the standard input.
LINE *INPUT FROM Reads lines fromRedirects athe textstandard streaminput.
LOCK*LINE INPUT LocksReads lines from ana openedtext stream.
Lof*LOCK ReturnsLocks thean length of aopened stream.
*Lof Returns the length of a stream.
*OPEN Opens a file for reading or writing and creates a stream for it.
*OUTPUT TO Redirects the standard output.
*PIPE Opens a named pipe for reading or writing and creates a stream for it.
*PRINT Prints expressions to a stream.
*READ Reads binary data from a stream.
*SEEK Change the position of the stream file pointer.
*Seek Gets the position of the stream file pointer.
*UNLOCK Unlocks an opened stream.
*WRITE Write binary data to a stream.
 
''File & Directory Functions''
*Access Tests the access authorization of a file.
*COPY Copy a file.
*DFree Returns the free space on a device.
*Dir Browses a directory.
*Exist Checks if a specific file or directory exists.
*IsDir Returns if a path points at a directory.
*KILL Removes a file.
*LINK Creates a symbolic link.
*MKDIR Creates a directory.
*MOVE Renames or moves a file or a directory.
*RDir Browses a directory recursively.
*RMDIR Removes an empty directory.
*Stat Get information about a file.
*Temp$ Makes temporary file names.
 
''Arithmetical Functions''
*Abs Returns the absolute value of a number.
*DEC Decrements a variable.
Fix Returns the integer part of a number.
Frac*Fix Returns the fractionalinteger part of a number.
Fix*Frac Returns the integerfractional part of a number.
INC Increments a variable.
*INC Increments a variable.
*Int Returns the mathematical integer part of a number.
*Max Returns the maximum number.
*Min Returns the minimum number.
*Round Rounds a number.
*Sgn Returns the sign of a number.
 
''Logarithms & Exponentials Functions''
*Cbr Cubic root
*Exp Exponential, e^x
*Exp2 2^x
*Exp10 10^x
*Expm Exp(x) - 1
*Log Neperian logarithm, base e logarithm
*Log2 Base 2 logarithm
*Log10 Decimal logarithm
*Logp Log(1+x)
*Sqr Square root
 
''Trigonometric Functions''
*ACos Computes the arc cosine of an angle.
*ACosh Computes the hyperbolic arc cosine of an angle.
*Ang Computes the angle polar coordinate from two rectangular coordinates.
*ASin Computes the arc sine of an angle.
*ASinh Computes the hybperbolic arc sine of an angle.
*ATan Computes the arc tangent of an angle.
*ATan2 Computes the arc tangent of two numbers.
*ATanh Computes the hyperbolic arc tangent of an angle.
*Cos Computes the cosine of an angle.
*Cosh Computes the hyperbolic cosine of an angle.
*Deg Converts radians to degrees.
*Hyp Calculate the hypotenuse of a triangle.
*Mag Computes the distance polar coordinate from two rectangular coordinates.
*Pi Returns π or a multiple of π.
*Sin Computes the sine of an angle.
*Sinh Computes the hyperbolic sine of an angle.
*Tan Computes the tangent of an angle.
*Tanh Computes the hyperbolic tangent of an angle.
*Rad Converts degrees to radians.
 
''Random Numbers Functions''
*RANDOMIZE Initializes the pseudo-random number generator.
*Rnd Returns a pseudo-random number.
 
Date & Time Functions
''Date & Time Functions''
*Date Returns a date without its time component.
*DateAdd Adds a period to a given date.
*DateDiff Returns the period between two dates.
*Day Returns the day of a Date value.
*Hour Returns the hours of a Date value.
*Minute Returns the minutes of a Date value.
*Month Returns the month of a Date value.
*Now Returns the current date and time.
*Second Returns the seconds of a Date value.
*Time Returns the time part of a Date value.
*Timer Returns the number of elapsed seconds since the program started.
*Week Returns the week number of a Date value.
*WeekDay Returns the week day of a Date value.
*Year Returns the year of a Date value.
 
''Datatype Functions''
*IsBoolean Returns if an expression is a Boolean value.
*IsByte Returns if an expression is a Byte value.
*IsDate Returns if an expression is a Date value.
*IsFloat Returns if an expression is a Float value.
*IsInteger Returns if an expression is an Integer value.
*IsLong Returns if an expression is a Long value.
*IsNull Returns if an expression is NULL.
*IsNumber Returns if an expression is a number.
*IsObject Returns if an expression is an Object value.
*IsShort Returns if an expression is a Short value.
*IsSingle Returns if an expression is a Single value.
*IsString Returns if an expression is a String value.
*TypeOf Returns the type of the value of an expression.
 
''Character Test Functions''
*IsAscii Tests if a string contains only ASCII characters.
*IsBlank Tests if a string contains only blank characters.
*IsDigit Tests if a string contains only digits.
*IsHexa Tests if a string contains only hexadecimal digits.
*IsLCase Tests if a string contains only lowercase letters.
*IsLetter Tests if a string contains only letters.
*IsPunct Tests if a string contains only printable non-alphanumeric characters.
*IsSpace Tests if a string contains only space characters.
*IsUCase Tests if a string contains only uppercase letters.
 
''Localization and Translation Functions''
 
Format$ Format a number or a date.
Str*Format$ ConvertsFormat a number or a date into a string.
Format*Str$ FormatConverts a number or a date into a string.
*Subst$ Substitutes strings in a pattern.
Tr$ Translate a string.
*Tr$ Translate a string.
*Val Converts a string into a number or a date.
 
''Formatting functions''
*Bin$ Format a number in binary.
*Format$ Format a number or a date.
*Hex$ Format a number in hexadecimal.
 
Para mas información visita [http://gambas.sourceforge.net/ http://gambas.sourceforge.net/]