Thomymaster 1 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 Share this post Link to post Share on other sites
Jos 1,856 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 Hide Jos's signature Hide all signatures 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. Share this post Link to post Share on other sites
jaberwacky 325 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 Hide jaberwacky's signature Hide all signatures 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? Share this post Link to post Share on other sites