Difference between revisions of "AS"

From QB64 Wiki
Jump to navigation Jump to search
imported>Clippy
m (Text replacement - "type" to "type")
 
(15 intermediate revisions by 4 users not shown)
Line 1: Line 1:
There are many different uses of the AS clause.
The [[AS]] keyword defines a variable data [[Variable Types|type]].  




To specify a variable's type in a declarative statement or parameter list:
{{PageDescription}}
* AS defines the variable or array type AS [[_BIT]], [[_BYTE]], [[INTEGER]], [[LONG]], [[_INTEGER64]], [[SINGLE]], [[DOUBLE]], [[_FLOAT]] or [[STRING]].
* Specifies a variable's [[Variable Types|type]] in a declarative statement or parameter list using:
** [[DIM]] or [[REDIM]]
** [[DECLARE LIBRARY]]
** [[SUB]]
** [[FUNCTION]]
** [[TYPE]]
** [[SHARED]]
** [[COMMON SHARED]]
** [[STATIC]]


[[COMMON]]


[[DECLARE]]
===Details===
* Specifies a '''[[parameter]]''' variable's type in a [[SUB]] or [[FUNCTION]] procedure. '''Cannot be used to define a function's [[Variable Types|type]]'''
* Specifies an element's type in a user-defined data [[TYPE]].
* Assigns a file number to a file or device in an [[OPEN]] statement.
* Specifies a field name in a random-access record (see [[FIELD]])
* Specifies a new file name when you rename a file (see [[NAME]])
* '''NOTE: Many QBasic keywords can be used as variable names if they are created as [[STRING]]s using the suffix '''$'''. You cannot use them without the suffix, use a numerical suffix or use [[DIM]], [[REDIM]], [[_DEFINE]], [[BYVAL]] or [[TYPE]] variable [[AS]] statements.'''


[[DEF FN]]


[[DIM]]
{{PageSeeAlso}}
* [[DIM]], [[REDIM]]
* [[_DEFINE]]
* [[BYVAL]], [[TYPE]]
* [[Variable Types]]


[[FUNCTION]]


[[REDIM]]
{{PageNavigation}}
 
[[SHARED]]
 
[[STATIC]]
 
[[SUB]]
 
To specify an elements type in a user-defined data type:
 
[[TYPE...END TYPE]]
 
To assign a file number to a file or device in an [[OPEN]] statement:
 
[[OPEN]]
 
To specify a field name in a random-access record:
 
[[FIELD]]
 
To specify a new file name when you rename a file:
 
[[NAME]]
 
 
 
==Navigation:==
 
[[Keyword_Reference_-_Alphabetical|Go to Keyword Reference - Alphabetical]]
 
[[Keyword Reference - By usage|Go to Keyword Reference - By usage]]

Latest revision as of 01:25, 24 January 2021

The AS keyword defines a variable data type.


Description


Details

  • Specifies a parameter variable's type in a SUB or FUNCTION procedure. Cannot be used to define a function's type
  • Specifies an element's type in a user-defined data TYPE.
  • Assigns a file number to a file or device in an OPEN statement.
  • Specifies a field name in a random-access record (see FIELD)
  • Specifies a new file name when you rename a file (see NAME)
  • NOTE: Many QBasic keywords can be used as variable names if they are created as STRINGs using the suffix $. You cannot use them without the suffix, use a numerical suffix or use DIM, REDIM, _DEFINE, BYVAL or TYPE variable AS statements.


See also



Navigation:
Keyword Reference - Alphabetical
Keyword Reference - By Usage
Main Wiki Page