Created
March 15, 2015 01:36
-
-
Save masakid/c527f49a8f2f7e1eb5ec to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| //文字列型から整数への変換 | |
| let width:String = "240" | |
| let height:String = "2" | |
| let menseki = width.toInt()! * height.toInt()! | |
| println("\(menseki)cm2") | |
| //文字列型からDouble型への変換 | |
| let r = 60 | |
| let pai = "3.14" | |
| //かけられる数もFloat型に直す必要あり | |
| let ensyu:Float = Float(2*r) * (pai as NSString).floatValue | |
| println("円周は\(ensyu)") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment