How to make a variable equal to Random.Range Result

Hello,
I have been trying to solve an issue, probably so simple that it occurs because of my lack of JavaScript knowledge which I am trying to improve.

My aim is to create a function for attacking, including different weapons and damages by Random.Range values. Since I am planning to make this system dynamic, I want to pull data from current players weapon I defined above into “var currentWeapon”, so random damage range will be displayed in it. To try this, I used temporary variables but I couldn’t compile it.

function attack() {
daggerRoll			= Random.Range(1,5);
clubRoll			= Random.Range(1,7);

shortswordRoll		= Random.Range(1,7);
longswordRoll		= Random.Range(1,9);
greatswordRoll		= Random.Range(1,13);
heavymaceRoll		= Random.Range(1,9);
handaxeRoll			= Random.Range(1,7);
greataxeRoll		= Random.Range(1,13);

slingRoll			= Random.Range(1,7);
shortbowRoll		= Random.Range(1,7);
longbowRoll			= Random.Range(1,9);
handcrossbowRoll	= Random.Range(1,7);
heavycrossbowRoll	= Random.Range(1,9);

	var charDEXMod	: float = 3;  //TEMP
	var charSTRMod 	: float = 5;  //TEMP
	var charBonus 	: float = 0;  //TEMP
	var currentWeapon = daggerRoll; //TEMP


	if (charDEXMod > charSTRMod) {
		charStatMod = charDEXMod;
	}
	else {
		charStatMod = charSTRMod;
	}

	attackDamage = currentWeaponRoll + charStatMod + charBonus;
	Debug.Log("Attack Damage: " + currentWeaponRoll +"+"+ charStatMod +"+"+ charBonus);
}

I also tried using it in a more static way like:

    var dagger : float;
    var club : float;
    	if (currentWeapon == dagger) {
    		currentWeaponRoll = Random.Range(1,5);
    	}
    	else if (currentWeapon == club) {
    		currentWeaponRoll = Random.Range(1,7);
    	}

but it only worked for the “if” statement above…

How can I solve this?

Thanks so much for your time!

FYI: charDEXMod > charSTRMod is to find if player/enemy is ranged or melee

It is a shame that I didn’t notice I wrote currentWeaponRoll instead of currentWeapon just above debug.log… It is working now flawless… Since my MonoDevelop is broken, I am using another compiler to write codes, I missed the error I guess:)

Thanks so much for your time!