Skip to content

Instantly share code, notes, and snippets.

@jjacobson93
jjacobson93 / if_let_test1.swift
Last active March 14, 2017 20:57
Swift If-let Statement
func giveMeAStringMaybe(_ maybe: Bool) -> String? {
return maybe ? "Yes!" : nil
}
let str: String? = giveMeAStringMaybe(true)
if let unwrappedStr = str {
print(unwrappedStr is String) // prints: true
print(unwrappedStr) // prints: "Yes!"
} else {
print(str) // prints: nil
function () {
if (!this.$sizingHeader) return;
this.$element.prepend(this.$sizingHeader);
var $sizingCells = this.$sizingHeader.find('th');
var columnCount = $sizingCells.length;
var tableWidth = $sizingCells.parent().width(); // Used to calculate the width percent
function matchSizingCellWidth(i, el) {