So that it is possible to store very large numbers or very small numbers. Special information about Floats and DoublesĪ floating-point number is stored in a way that makes the binary point "float" around the number, Pointers are declared with a '*' in front of the variable name. Value * 2 The same as: Value = Value * 2īuild structured types, via the Structure keyword. Returns the remainder of the RHS by LHS integer division.Ī=16 % 2 The value of a will be 0 as 16/2 = 8 (no remainder)ī=17 % 2 The value of a will be 1 as 17/2 = 8*2+1 (1 is remaining)Įvery math operators can be used in a shorthand form.Įxample Value + 1 The same as: Value = Value + 1 Str(), Str() or StrD() with their defaults for the optional parameters.Ī$ = b$ + " more" Combines the content of the string "b$" with the string " more" and save this into the string "a$"Ī$ + b$ Attach the content of the string b$ directly to the string a$. Numeric values are also accepted for combination with a string. Operator or will be directly stored into the string on the LHS. With strings the '+' is also valid for combining the contents of two strings, where the result will be assigned to the string on the LHS with the '=' Variable+expression The value of "expression" will be added directly to the variable "variable" Number=something+2 Adds the value 2 to "something" and uses the result with the equals operator If the result of this operator is not used and there is a variable on the LHS, then the value of the expression on the RHS will be added directly to the variable on the LHS. Gives a result of the value of the expression on the RHS added to the value of the expression on the LHS. The table below shows the operators you can use in PureBasic, in no particular order (LHS = Left Hand Side, Operators are the functions you can use in expressions to combine the variables, constants, and whatever else. Note: The floating numbers (floats + doubles) can also be written like this: 123.5e-20ĭebug value will give 0.000000000000000001235 When the string variable is declared the first time.ĭebug a will give "One string" Debug a$ will give "Another string" The '$' belongs to the variable name and must be always attached, unlike the '.s' which is only needed This way you can use 'a$' and 'a.s' as different string variables. Notation of string variables: it is possible to use the '$' as last char of a variable name to The character (.c) type is an unsigned word in unicode that may be used as an unsigned type. Purebasic offers native support for unsigned variables with byte and word types via the ascii (.a) and unicode (.u) types. Here is the list of the native supported types and a brief description : PureBasic allows many type variables which can be standard integers, float, double, quad and char numbers Keyword in your source code to enable this feature. Of variables, before they are first used. it's possible to force the PureBasic compiler to always want a declaration Values for ID's etc.), you can also take a look at constants as an alternative. If you don't need to change the content of a variable during the program flow (e.g. The variables in PureBasic are not case sensitive, so "pure" and "PURE" are the same variable. Variable names must not start with a number (0,1.), contain operators (+,-.) or special characters (ß,ä,ö,ü.). If you don't assign an initial value to the variable, theirĮxample a.b Declare a variable called 'a' from byte (.b) type.Ĭ.l = a*d.w 'd' is declared here within the expression and it's a word ! Notes: The Define keyword can be used to declare Variables do not need to be explicitly declared, as theyĬan be used as "variables on-the-fly". By default, when a data type is not indicated, the data is an integer. To declare a variable in PureBasic, simply type its name.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |