Help:VE273: Difference between revisions

From TrainzOnline
Jump to navigationJump to search
Created page with "'''Variable $(VARIABLE NAME) already declared in this scope.''' This error is reported by the TrainzScript compiler when a variable name is already in use in the current ..."
 
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
'''Variable $(VARIABLE NAME) already declared in this scope.'''
'''Variable '<variable name>' already declared in this scope.'''


This error is reported by the [[TrainzScript]] compiler when a variable name is already in use in the current scope.
This error is reported by the [[TrainzScript]] compiler when a variable name is already in use in the current scope.
'''Example'''<br>
In this example, the variable 'duplicateTest' is declared twice in the top-level function scope. The second declaration is illegal and will generate an error.
<nowiki>void TestFunction(void)
{
  int duplicateTest = 0;
  int duplicateTest = 0;
}</nowiki>
See also: [[Help:VE274|Error 274]]
[[Category:Validation Errors]]

Latest revision as of 01:46, 17 May 2024

Variable '<variable name>' already declared in this scope.

This error is reported by the TrainzScript compiler when a variable name is already in use in the current scope.

Example
In this example, the variable 'duplicateTest' is declared twice in the top-level function scope. The second declaration is illegal and will generate an error.

void TestFunction(void)
{
  int duplicateTest = 0;
  int duplicateTest = 0;
}

See also: Error 274