Last active
April 29, 2017 23:40
-
-
Save Shaolo/4c7b155be9e06320ea578469b9022691 to your computer and use it in GitHub Desktop.
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
//: Playground - noun: a place where people can play | |
import UIKit | |
//import Foundation | |
var Vin:Double = 400 | |
var r1:Double = 100 | |
var r2:Double = 5 | |
var Vout:Double = Vin * (r1 / (r1 + r2)) | |
print(Vout) | |
if let value = NSExpression(format: "Vin * (r1 / (r1+r2))") | |
.expressionValue(with: ["Vin":Vin, | |
"r1":r1, | |
"r2":r2], | |
context: nil) { | |
print(value) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment