Created
November 22, 2014 08:28
-
-
Save tikidunpon/6b1cef19827ef93c945d to your computer and use it in GitHub Desktop.
SwiftのREPLのメモ ref: http://qiita.com/tikidunponpon/items/66e459b0bee83eb2e103
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1> "100".toInt() | |
$R0: Int? = 100 | |
2> var a = 250 | |
a: Int = 250 | |
3> func sum(val1:Int, val2:Int)->Int{ | |
4. return val1 + val2 | |
5. } | |
6> | |
7> sum(10, 20) | |
$R1: Int = 30 | |
8> let result = sum($R0, a) | |
repl.swift:8:18: error: value of optional type 'Int?' not unwrapped; did you mean to use '!' or '?'? | |
let result = sum($R0, a) | |
^ | |
! | |
8> let result = sum($R0!, a) | |
9. | |
result: Int = 350 | |
9> result = 500 | |
repl.swift:9:8: error: cannot assign to 'let' value 'result' | |
result = 500 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment