Wiki source for KeyPgDefshort


Show raw source

{{fbdoc item="title" value="DEFSHORT"}}----
Specifies a default data type for a range of variable names

{{fbdoc item="syntax"}}##
**Defshort** //start_letter//[**-**//end_letter// ][, ...]
##
{{fbdoc item="param"}}
##//start_letter//##
the first letter in the range
##//end_letter//##
the last letter in the range

{{fbdoc item="desc"}}
##**Defshort**## specifies that variables and arrays which aren't declared with a data type - or not declared at all - are implicitly declared of type ##[[KeyPgShort|Short]]## if the first letter of their names matches a certain letter or lies within an inclusive range of letters.

{{fbdoc item="ex"}}
This will make ##sNumber## a ##[[KeyPgShort|Short]]## number since its first letter starts with ##s##.
{{fbdoc item="filename" value="examples/manual/switches/defshort.bas"}}%%(freebasic)
'' Compile with -lang fblite or qb

#lang "fblite"

DefShort s
Dim sNumber
%%

{{fbdoc item="lang"}}
- Available in the //[[CompilerOptlang|-lang fblite]]// dialect.
- Not available in the //[[CompilerOptlang|-lang qb]]// dialect unless referenced with the alias ##**""__Defshort""**##.

{{fbdoc item="diff"}}
- New to ""FreeBASIC""
- In QBasic, to make variables default to a 2 byte integer, DEFINT is used.

{{fbdoc item="see"}}
- ##[[KeyPgDefint|Defint]]##
- ##[[KeyPgDefushort|Defushort]]##
- ##[[KeyPgDim|Dim]]##
- ##[[KeyPgInteger|Integer]]##
- ##[[KeyPgShort|Short]]##

{{fbdoc item="back" value="CatPgCompilerSwitches|Compiler Switches"}}
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki



sf.net phatcode