@Option Directive

Makes sure that your code agrees with a given style.

Syntax

@Option options [ , options ]…

Parts

options
Mandatory one or more identifiers

Instructions

Charset

@Option charset Latin

All names must use the Latin character set. That is letters (‘A’ thru ‘Z’), digits (‘0’ thru ‘9’), and underscores (‘_’).

Dim

@Option Dim

You must start a variable declaration with Dim, and not Var. For example:

Dim x As Int

@Option Var

You must start a variable declaration with Var, and not Dim. For example:

Var x As Int

End

@Option End Block

You must write End plus the block type. For example:

While condition
  ' ...
End While

@Option End [ No Block ]

You must write End without the block type. For example:

While condition
  ' ...
End

@Option End For ID

You can use this only with “@Option End Block”. You must complete all statements of the type Forwith End For, plus the loop counter. For example:

For index = 1 To 10
  ' ...
End For index

@Option End For [ No ID ]

You can use this only with “@Option End Block”. You must complete all statements of the type For with End For, without the loop counter. For example:

For index = 1 To 10
  ' ...
End For

Enum

@Option Enum ID

You must give a name to all statements of the type Enum. For example:

Enum DogBreed
  ' ...
End

@Option Enum Is

You must give statements of the type Enum a data type, with the clause Is. For example:

Enum Is UInt16
  ' ...
End

@Option Enum Equals

You must give members of the statement Enum values, assigned with the operator “=”. For example:

Enum
  first  = 1
  second = 2
End

If

@Option If Then

You must write Then with all statements of the type If…Else. For example:

If condition1 Then
  ' ...
Else If condition2 Then
  ' ...
End

@Option If [ No Then ]

You must not write Then with the block construct of the statement If…Else. For example:

If condition1
  ' ...
Else If condition2
  ' ...
End

@Option If End

You must complete statements of the type If…Else with End or End If. If you use “@Option End Block”, then you must write End If. Thus, use of the one-line construct becomes an error.

Last

@Option Last

No more directives of the type @Option are permitted after this one.

New

@Option New

You must start New Statements with New. If you use “@Option End Block”, then you must complete the block construct with End New. For example:

New Files #logs, "*.log"

New Menu #file, "File"
Begin
  ' ...
End New

Optional

@Option Optional Equals

You must give a value to an optional parameter with the operator “=”. For example:

Method ReadData(Optional path As String = ".")
  ' ...
End

Select

@Option Select Case

You must write Select Case in all statements of the type Select…Case. For example:

Select Case test
  ' ...
End

@Option Select [ No Case ]

You must not write the keyword Case after Select in all statements of the type Select…Case.

@Option Select Else

You must write the clause “Case Else” for all statements of the type Select…Case. This is to make sure that you do something for all possible values. For example:

Select minutes
Case 0 To 29
  ' ...
Case 30 To 59
  ' ...
Case Else
  Raise RangeError(minutes)
End

Unit

@Option Unit Full

You must write the full names of units of measure. Thus “kilometer” is correct syntax, but “km” is incorrect.

Warning

@Option Warning[1-5]

Option ViviFire shows
Warning1 Only warnings with a risk more than 75% to cause problems
Warning2 Only warnings with a risk more than 50% to cause problems
Warning3 Only warnings with a risk more than 25% to cause problems
Warning4 or Warning Only warnings with a risk more than 0% to cause problems (Default)
Warning5 All warnings, if they cause problems or not.

@Option Warning[1-5] Error

When you add Error, all warnings at that level and below become errors. You can use the two syntaxes together if the level for errors is less than the level for warnings. An example follows.

@Option Warning1 Error, Warning5

See also