vendredi 27 février 2015

Math expression in swift repl


I have a code



#!/usr/bin/env xcrun swift
import Foundation

let expn = NSExpression(format:"2+2*2")

println(expn.expressionValueWithObject(nil, context: nil))


How to make so that I introduced the mathematical expression in the console for example



./File.Swift 5 + 6 * pi / 2




Aucun commentaire:

Enregistrer un commentaire