Skip to content

OPTION EXPLICIT


强制在使用变量、对象和数组之前先声明它们

语法

` Option Explicit

`

描述

Option Explicit 是一个语句,强制后续所有变量、对象或数组的使用必须以声明为前提,例如使用 DimStatic。此规则对使用 Option Explicit 的模块的其余部分有效,且无法被覆盖。

示例

start GeSHi

vb
'' Compile with the "-lang qb" or "-lang fblite" compiler switches

#lang "fblite"

Option Explicit

Dim a As Integer            ' 'a' must be declared..
a = 1                       ' ..or this statement will fail to compile.

end GeSHi

方言差异

与 QB 的差异

  • FreeBASIC 新增

参见

  • __FB_OPTION_EXPLICIT__

返回 目录

基于 FreeBASIC 官方文档翻译 如有侵权请联系我们删除
FreeBASIC 是开源项目,与微软公司无隶属关系