#!/usr/bin/env swift; /****************************************************************************** * This program computes min() and max() * * Copyright © 2020 Richard Lesh. All rights reserved. *****************************************************************************/ import Foundation import Utils func imin(_ a:Int, _ b:Int) -> Int { return a < b ? a : b } func imax(_ a:Int, _ b:Int) -> Int { return a > b ? a : b } func main() -> Void { for x:Int in -1...1 { for y:Int in -1...1 { print(Utils.format("imin({0}, {1}) = {2}", x, y, imin(x, y))) } } for x:Int in -1...1 { for y:Int in -1...1 { print(Utils.format("imax({0}, {1}) = {2}", x, y, imax(x, y))) } } exit(EXIT_SUCCESS) } main()