Hello everyone.
I'm working on making a little card game, and therefore i need to be able to deal cards.
so im working on function to give you a card.
I tried this piece of code:
Code:
switch (card) { //heart, diamond, clubs or spade
case (card<= 13):
cardEmblem = "heart";
break;
case (card <= 26):
cardEmblem = "diamond";
break;
case (card <= 39):
cardEmblem = "clubs";
break;
case (card <= 52):
cardEmblem = "spade";
}
and it didn't work. so i read in Alex' book that the general syntax for switch statements are that where i write (card <= 13) only one value can be.
so my question, do i have to do this with else if statements?
Or is it possible with the switch?
Thanks in advance