Chapter 9 : Datatype : Boolean
Booleans are logical data type that can have only two values. true or false.
//
// main.swift
// Swift Tutorials 2014-15
// Boolean in Swift
//
// Created by Code2care on 15/09/14.
// Copyright (c) 2014 Code2care. All rights reserved.
//
var myBoolA:Bool = true
var myBoolB = false
println("\(myBoolA)")
println("\(myBoolB)")
//
// main.swift
// Swift Tutorials 2014-15
// Boolean in Swift
//
// Created by Code2care on 15/09/14.
// Copyright (c) 2014 Code2care. All rights reserved.
//
var a = 20;
var b = 20;
/*
== operator is used to test equality of the two variables.
If both values are same, If condition returns True, else False
*/
if(a == b) {
println("Both values are equal!");
}
if(a > b) {
println("var1 is greater then var2 values are equal!");
}