Sponsored

Collapse

Announcement

Collapse
No announcement yet.

You're Always Right - Swift Playgrounds

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • You're Always Right - Swift Playgrounds

    The challenge of this level is to use any coding construct and pattern you like!

    For your final while loops challenge, toggle open all of the closed switches and collect the gems. Choose from your existing skills to solve the puzzle.

    Remember, it's okay if you don't get it on your first try! Professional coders hardly ever get things right the first time around. Your goal is to write some code and keep tweaking it until it works. Good luck!
    Click image for larger version  Name:	Screen Shot 2017-01-01 at 6.20.55 PM.png Views:	1 Size:	288.4 KB ID:	1226


    Hint: Find your way to the gem while toggling all of the closed switches. Figure out which of the skills you've learned will work best to accomplish this goal.

    The solution for this level is shown below:

    Code:
    while !isBlocked {
    while !isBlocked{
    moveForward()
    if isOnClosedSwitch {
    toggleSwitch()
    }
    }
    turnRight
    if isOnGem {
    collectGem()
    }
    }
    Outstanding solution! Take a second to celebrate, you've just completed while loops! Your concentration and effort are paying off. Now it's time to learn about algorithms.

    Next lesson is introduction to algorithms.

  • #2
    Thank you. You helped me pass my computer class!

    Comment


    • #3
      From sleeping in separate beds to their children to transporting them in prams, Western parents have some unusual ideas about how to raise. Korean people are very diligent and driven. For kids, a lot of the drive comes from bhartiyacollege.org parental pressure and social competition. Both factors have up sides.Kids are forced to wake up till late night hours due to the pressures created by the education policies of particular countries. There is so much pressure that kids are made to wake up to complete their examination syallabus.

      Comment

      Apple Swift Programming Language

      About this Group

      Discussion group for Swift programming language by apple for Xcode
      Type: Public
      Topics: 112
      Comments: 96

      Owner

      Sponsored Box

      Collapse

      Latest Group Topics

      Collapse

      There are no results that meet this criteria.

      Working...
      X