Quantcast
Viewing latest article 6
Browse Latest Browse All 50

Swift Playgrounds comparison operators

So, I'm currently learning Swift (with no programming experience at all) with Swift Playgrounds.

I am currently on Learn To Code 2 at the level Round Up the Switches.
My solution for this level was:

Swift:
var numberOfGems = 0
var numberOfSwitches = 0

func checkTile() {
    if isOnGem {
        collectGem()
        numberOfGems += 1
    }
    if isOnClosedSwitch {
        toggleSwitch()
        numberOfSwitches += 1
    }
}

func checkWhereToGo() {
    if isBlocked {...

Read more

Viewing latest article 6
Browse Latest Browse All 50

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>