Thomymaster Posted June 28, 2015 Share Posted June 28, 2015 Hi everybody I want to declare a constant according to values of an evaluation, like this: Switch $iTemp Case -1 And @error=6 Global Const $g_iOption1="-1" Case 0 Global Const $g_iOption1="0" Case else Global Const $g_iOption1="1" EndSwitch However when i do this, my code checker (AU3Check 3.3.13.19) tells me: error: $g_iOption1 previously declared as a 'Const'. But the syntax i use is correct. What can i do? Best,Thomas Link to comment Share on other sites More sharing options...
Developers Jos Posted June 28, 2015 Developers Share Posted June 28, 2015 Au3check doesnt run your script aso merely tells you that you have multiple definitions of the same constant.It feels you are trying to emulate a directive but you really should avoid using a constant when you still have script logic to set the variable.jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
jaberwacky Posted June 28, 2015 Share Posted June 28, 2015 You have this option too:Global Const $g_iOption1 = _name_of_function($iTemp, @error) Func _name_of_function(Const $name_of_variable, Const $error) Switch $name_of_variable Case -1 And $error = 6 Return "-1" Case 0 Return "0" Case else Return "1" EndSwitch EndFunc Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now