lundi 8 janvier 2018

Trouble with if statements, returning a syntaxerror

I'm programming blackjack and trying to input rules for the dealer. The code I've got is as follows

if sum(dealer$cards<17){
  dealer=twist(dealer)
}else if sum(dealer$cards>17){
    dealer=stick(dealer)
}else{
    dealer
}

This returns an error message Error: unexpected '}' in "}". In the script it also states "unexpected token 'sum', expected 'LPAREN'. Not sure where I am going wrong? Maybe because it's late I just can't see it.

Aucun commentaire:

Enregistrer un commentaire