Pure Programmer
Blue Matrix


Cluster Map

Tuples

L1

This page is under construction. Please come back later.

Tuples1.swift
#!/usr/bin/env swift;
import Foundation
import Utils

func main() -> Void {
	var pair1 = ("Hello", 5)
	var pair2:(Int, Double)
	var pair3:(String, Double)

	pair2 = (3, 3.1415926)
	pair3 = ("Goodbye", 1.5)

	print(pair1.0 + "," + String(pair1.1))
	print(String(pair2.0) + "," + String(pair2.1))
	print(Utils.tupleToString(pair3))
	exit(EXIT_SUCCESS)
}
main()

Output
$ swiftc Tuples1.swift -I . -L . -lUtils error: link command failed with exit code 1 (use -v to see invocation) ld: library not found for -lUtils clang: error: linker command failed with exit code 1 (use -v to see invocation)
Tuples2.swift
#!/usr/bin/env swift;
import Foundation

func main() -> Void {
	var pair1 = ("Hello", 5)
	var tuple1 = ("Goodbye", 3, 3.1415926)
	var tuple2 = (1.6, 2.5, 5, "C")

	print(pair1.0 + "," + String(pair1.1))
	print(tuple1.0 + "," + String(tuple1.1) + "," + String(tuple1.2))
	print(String(tuple2.0) + "," + String(tuple2.1) + "," + String(tuple2.2) + "," + tuple2.3)
	exit(EXIT_SUCCESS)
}
main()

Output
$ swiftc Tuples2.swift -I . -L . -lUtils error: link command failed with exit code 1 (use -v to see invocation) ld: library not found for -lUtils clang: error: linker command failed with exit code 1 (use -v to see invocation)
swift

Questions

Projects

More ★'s indicate higher difficulty level.

References