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 ! 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". To learn whether value is returned by a specific command or function, consult the description provided in the command's documentation.To declare a variable in PureBasic, simply type its name. In the PureBasic documentation, the terms "commands" and "functions" are used interchangeably, regardless of whether the function returns a value or not. Is specified in the Syntax line of the command description. Return values of commands are always Integer if no other type In this guide, all topics are listed in alphabetical order to decrease any search time. "And a very long message, so we can use the multiline" + #LF$ + Text$, MessageRequester("Hello this is a very long title", Long expressions can be split across several lines.Ī split line has to end with one of the following operators: plus (+), comma (,), or (|), And, Or, Xor.Įxample Text$ = "Very very very very long text" + #LF$ + Strings must be enclosed within straight double quotes.Ī = a + WindowHeight( #Window) + b/2 + #M圜onstant If a 12 + 2įoo = Foo + $69 / %1001 Hexadecimal and binary number usageĪny number of commands can be added to the same line by using the : option.Įxample If IsCrazy = 0 : MessageRequester("Info", "Not Crazy") : Else : MessageRequester("Info", "Crazy") : EndIf Without either of those, the number will be treated as decimal. To indicate a hexadecimal number, or with the % symbol to indicate a binary number. When using numbers in an expression, you can prefix them with the $ symbol Modules Modules use a :: (double colon) when referencing a module name.īe careful not to confuse these with the single colon used by labels.Īn expression is something which can be evaluated.Īn expression can mix any variables, constants, or functions, of the same type. Labels defined inside a procedure will be available only in that procedure. Label names may not contain any operators (+,-.) or special characters (ß,ä,ö,ü.). Warning: On Windows, \t does not work with the graphical functions of the 2DDrawing and VectorDrawing libraries.Įxample a$ = "Hello world" standard stringī$ = ~"Escape\nMe !" string with escape sequencesĪll labels must be followed by a colon : character. This can be used for APIįunctions requiring a null pointer to a string, or to really free a string. #Empty$: represents an empty string (exactly the same as "") There are two special constants for strings: Literal strings are declared using the " character.Įscape sequences are supported by prepending the ~ character to the literal string. (The compiler replaces all constant names with their corresponding values when compiling the executable.) They can only be declared once in the source and always keep their predefined values. Functions are regularly included in the PureBasic "Command libraries", described on the right side ofĪll constants are preceded by the hash # character. ElseĮndIf Keywords are regularly described in the chapters on the left side ofĮvery function must be followed by an opening round bracket '(' character, otherwise it will not be considered a function (this applies also to functions without parameters).Įxample EventWindow() it is a function.ĮventWindow it is a variable. They are not followed by the brackets '()', which areĮxample If a = 1 If, Else and EndIf are keywords while 'a = 1' Or controlling the program flow (If : Else : EndIf). These are:Įxample If a = 10 This is a comment to indicate something.Īll keywords are used for general things inside PureBasic, like creating arrays (Dim) or lists (NewList), PureBasic has established rules which never change.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |