Just wanted to know, I'm just doing a little dice rolling thing thats storing dice values according to how many times they come up every so often, just wondering if instead of making 50 lines of code doing
if(sum==1)
{
ones+=1;
}
else if(sum==2)
{...
and so on,
I'm thinking of arrays and stuff but cant come up with anything, I like my code to be short and effective, I HATE if-thens if used like I have it above and would like to use a more clever way.
Manutebecker 0 Junior Poster in Training
VernonDozier 2,218 Posting Expert Featured Poster
n1337 29 Junior Poster in Training
VernonDozier commented: Good catch! :) +5
VernonDozier 2,218 Posting Expert Featured Poster
CoolGamer48 65 Posting Pro in Training
VernonDozier 2,218 Posting Expert Featured Poster
CoolGamer48 65 Posting Pro in Training
VernonDozier 2,218 Posting Expert Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.