Why does ‘valueOnSecondDice’ have to be declared after the first while statement but not as a global variable?
while valueOnFirstDice <= 6 {
var valueOnSecondDice = 1
while valueOnSecondDice <= 6 {
totalNumberOfRoles += 1
if valueOnFirstDice + valueOnSecondDice == targetValue {
combinationsFound += 1
}
valueOnSecondDice += 1
}
valueOnFirstDice += 1
}