Selection
This page is under construction. Please come back later.
#!/usr/bin/env swift; import Foundation // Begin Main print("Start...") if CommandLine.arguments.count != 3 { print("You need at least two command line arguments!") } print("Finish...") exit(EXIT_SUCCESS)
Output
$ swiftc Selection1.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)
$ swiftc Selection1.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)
#!/usr/bin/env swift; import Foundation import Utils // Begin Main let x:Int = Int(CommandLine.arguments[1]) ?? 0 print("Start...") if x > 10 { print("Greater than 10") } else { print("Less than or equal to 10") } print("Finish...") exit(EXIT_SUCCESS)
Output
$ swiftc Selection2.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)
$ swiftc Selection2.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)
#!/usr/bin/env swift; import Foundation import Utils // Begin Main let x:Int = Int(CommandLine.arguments[1]) ?? 0 print("Start...") if x > 1000 { print("Greater than 1000") } else if x > 100 { print("Greater than 100 but less than or equal to 1000") } else { print("Less than or equal to 100") } print("Finish...") exit(EXIT_SUCCESS)
Output
$ swiftc Selection3.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)
$ swiftc Selection3.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)
$ swiftc Selection3.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)
#!/usr/bin/env swift; import Foundation import Utils // Begin Main let x:Int = Int(CommandLine.arguments[1]) ?? 0 switch x { case 1: print("One") case 2: print("Two") case 3, 4: print("Three or Four") default: print("Just don't know!") } exit(EXIT_SUCCESS)
Output
$ swiftc Selection4.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)
$ swiftc Selection4.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)
$ swiftc Selection4.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)
$ swiftc Selection4.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)
$ swiftc Selection4.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)
#!/usr/bin/env swift; import Foundation import Utils // Begin Main var x:String = Utils.substr(CommandLine.arguments[1], 0, 1) x = x.lowercased() switch x { case "a", "e", "i", "o", "u": print(Utils.format("{0:c} is a vowel", Utils.ord(x))) case "y": print("y is sometimes a vowel") default: print(Utils.format("{0:c} is a consonant", Utils.ord(x))) } exit(EXIT_SUCCESS)
Output
$ swiftc Selection5.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)
$ swiftc Selection5.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)
$ swiftc Selection5.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)
$ swiftc Selection5.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)
$ swiftc Selection5.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)
Questions
- {{Who's on first?}}
- {{Who's on second?}}
- {{Who's on third?}}
Projects
More ★'s indicate higher difficulty level.
- FICA Taxes (Revisited)
- FICA Taxes (Empoyee and Employer)
- Football Passer Rating (NFL and NCAA)
- Income Tax (Single Taxpayer)
- Income Tax
- Pythagorean Theorem
- Retirement Calculator
References
- [[Swift Community]]
- [[Swift Language Guide]]
- [[Swift Language Reference]]
- [[Swift Programming Language]], Apple Inc.
- [[Swift Doc]]
- [[We Heart Swift]]
- [[Swift Cookbook]]
- [[Swift Playground]]
- [[Swift at TutorialsPoint]]
- [[Hacking with Swift]]