Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Mikkel Storch
1,955 PointsSwift - command prompt?
Hello I just started the Swift course and was wondering if there was any kind of command prompt where you can input data just like C#. I've been programming a bit in C# some years ago, and it had the feature to view your code from a command prompt and input your own user data as the code progressed. Does Swift have any feature like that? Thanks...
2 Answers
dd710
24,896 PointsYes, Swift has a REPL(Read , Evaluate Print Loop) called a playground that can be created within the Xcode framework. File->New->Playground. You can also open up a terminal app on a mac and run "xcrun swift" which starts a REPL in the command line. As of Xcode 6.1 - typing swift in the terminal launches the REPL as well.
dd710
24,896 PointsI'm sorry but I'm a little unclear on what you're describing, could you explain it a little more because from what your saying sounds more like the type of program that your C# example(A program that takes input from the user) is as opposed to the capabilities of Xcode and Swift.
Mikkel Storch
1,955 PointsMikkel Storch
1,955 PointsHi dd710 Thanks for the answer. But i am in the playground. When in C#, you write your code and when thats done you want to execute it to see have it works. Where you can input your own data when the code waits for some input. For example if you need to calculate the area of a room and you want the user to input the height and width of the room. You understand me? :p