Assign

The obsolescent assign statement: stores a label in an integer variable.

Declaration

Syntax

Assign(int label, identifier variable)

Arguments

Argument

Description

label

the statement label being stored.

variable

the name of the integer variable it is stored in.

Return values

None.

Description

assign 100 to label stores a statement label rather than an integer value in label, for use by an assigned go to. The feature was deleted in Fortran 95 and is supported for legacy code.

The variable holds a label, not a number, so the only thing that may be done with it is an assigned go to; using it in arithmetic is not meaningful.

Examples

(Assign
  :label 100
  :variable "label"
)

It comes from this complete ASR text document:

(TranslationUnit
  :symtab (SymbolTable
    :id 0
    :symbols {
      "main" (Program
        :symtab (SymbolTable
          :id 1
          :symbols {
            "i" (Variable
              :parent_symtab 1
              :name "i"
              :dependencies []
              :intent :Local
              :symbolic_value nil
              :value nil
              :storage :Default
              :type (Integer
                :kind 4
              )
              :type_declaration nil
              :abi :Source
              :access :Public
              :presence :Required
              :value_attr false
              :target_attr false
              :contiguous_attr false
              :bindc_name nil
              :is_volatile false
              :is_protected false
              :pass_attr :NotMethod
              :self_argument nil
              :codims []
            )
            "label" (Variable
              :parent_symtab 1
              :name "label"
              :dependencies []
              :intent :Local
              :symbolic_value nil
              :value nil
              :storage :Default
              :type (Integer
                :kind 4
              )
              :type_declaration nil
              :abi :Source
              :access :Public
              :presence :Required
              :value_attr false
              :target_attr false
              :contiguous_attr false
              :bindc_name nil
              :is_volatile false
              :is_protected false
              :pass_attr :NotMethod
              :self_argument nil
              :codims []
            )
          }
        )
        :name "main"
        :dependencies []
        :body [
          (Assign
            :label 100
            :variable "label"
          )
          (GoTo
            :target_id 100
            :name "100"
          )
          (Assignment
            :target (Var
              :v (SymbolRef 1 "i")
            )
            :value (IntegerConstant
              :n 1
              :type (Integer
                :kind 4
              )
              :intboz_type :Decimal
            )
            :overloaded nil
            :realloc_lhs false
            :move_allocation false
          )
          (GoToTarget
            :id 100
            :name "100"
          )
          (IfArithmetic
            :test (Var
              :v (SymbolRef 1 "i")
            )
            :lt_label 100
            :eq_label 100
            :gt_label 100
          )
        ]
      )
    }
  )
  :items []
)

See Also

GoTo, GoToTarget, Variable