File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change
1
+ //
2
+ // PracticeInput.swift
3
+ //
4
+ //
5
+ // Jessica Joseph on 4/1/15.
6
+ //
7
+ //
8
+
9
+ import Foundation
10
+
11
+ func input() -> String{
12
+ var keyboard = NSFileHandle.fileHandleWithStandardInput()
13
+ var inputData = keyboard.availableData
14
+ return NSString(data: inputData, encoding: NSUTF8StringEncoding)! //Swift requires a ('!' OR '?') at the end
15
+
16
+ // Why is NSString considered to be an optional value?
17
+ // What does it mean when an optional type is not unwrapped?
18
+ // Why would I need to add the ('!' OR '?') at the end of the return statement?
19
+
20
+ //ALSO, Since this function takes no parameter, how could I actually use it?
21
+ }
22
+
23
+
24
+ // Python 2.7 has the raw_input("..") BIF(built in function) and Python 3 has the input("...") BIF
25
+ // What is the swift equivalent? As of right now it seems like there isn't any equivalent
26
+ // Is Apple planning on adding a swift equivalent of raw_input() or input()?
You can’t perform that action at this time.
0 commit comments