Post

Replies

Boosts

Views

Activity

Reply to How to write a method to sort out black and red cards Newbie to Swift
// red hearts and diamonds. // black spades and clubs // 20 Jan 2023 ML // a function called checkRed to determine red hearts and diamonds func checkRed(RHearts:Bool, RDiamonds:Bool)-> Bool { let redVal: Bool // redVal is a return value in boolean format redVal = true // if the parameters RHearts,RDiamonds are set to true means red cards // let RHearts = // let RDiamonds = // they are red hearts & red diamond cards selected // redVal is boolean //logic must be ANDED if (RHearts && RDiamonds) { print ("Red cards are :",Suit.Diamonds,Suit.Hearts ) } else { _ = false print("Black cards are :", Suit.Clubs, Suit.Spades ) } return redVal }// end of checkRed func brace checkRed(RHearts: true, RDiamonds:true)
Jan ’23
Reply to How to write a method to sort out black and red cards Newbie to Swift
// red hearts and diamonds. // black spades and clubs // 20 Jan 2023 ML // a function called checkRed to determine red hearts and diamonds func checkRed(RHearts:Bool, RDiamonds:Bool)-> Bool { let redVal: Bool // redVal is a return value in boolean format redVal = true // if the parameters RHearts,RDiamonds are set to true means red cards // let RHearts = // let RDiamonds = // they are red hearts & red diamond cards selected // redVal is boolean //logic must be ANDED if (RHearts && RDiamonds) { print ("Red cards are :",Suit.Diamonds,Suit.Hearts ) } else { _ = false print("Black cards are :", Suit.Clubs, Suit.Spades ) } return redVal }// end of checkRed func brace checkRed(RHearts: true, RDiamonds:true)
Replies
Boosts
Views
Activity
Jan ’23