Home > Articles > Programming > General Programming/Other Languages

  • Print
  • + Share This
This chapter is from the book

Q&A

  • Q. Is Swift on iOS the same as on OS X?

    A. For the most part, yes. OS X includes thousands of additional application programming interfaces (APIs), however, and provides access to the underlying UNIX subsystem.

  • Q. Can an if-then-else statement be extended beyond evaluating and acting on a single expression?

    A. Yes. The if-then-else statement can be extended by adding another if statement after the else:

    if <expression> {
      // do this, the expression is true.
    } else if <expression> {
      // the expression isn't true, do this instead.
    } else {
      // Neither of the expressions are true, do this anyway!
    }

    You can continue expanding the statement with as many else-if statements as you need.

  • Q. Why is the Playground better than coding up a new project? Seems the same to me.

    A. The biggest advantage of the iOS Playground is that it lets you see instant feedback from the code you enter. In addition, you don’t even have to add output statements to inspect the contents of variables you declare; they appear automatically in the Playground margin.

  • + Share This
  • 🔖 Save To Your Account