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

iOS Swift Basics (retired) Types Printing Results

Christopher Zabaleta
Christopher Zabaleta
297 Points

I am getting print(value: T) instead of print(object: T) causing an error message. Please help

how can i fix this or get around it so i can use the print function in the console output?

Jon Schenck
Jon Schenck
2,028 Points

If you could attach your code to your question that would be great. It helps me and others to understand your problem visually.

Christopher Zabaleta
Christopher Zabaleta
297 Points

//: Playground - noun: a place where people can play

import UIKit

var str : String = "Hello "

let modernProgrammingLanuage : String = "Swift"

var greeting = str + modernProgrammingLanuage // implicit type String or inferred type String

print(value: T)

-Im following the Swift Basics tutorial and he says I should get print(object: T) but thats not what it shows. Im not getting the print(object: T) option.

1 Answer

you should clear the parenthesis on the print command. Xcode "hints" at what some commands should include, but that's not always what you want. To print a simple string for example you only use.

print("Hello!")

or to print a variable

var hello = "Hello World!"
print(hello)

also, notice that the "p" in print is not capitalized

so, in your case, if you want to print the variable greeting you just type

print(greeting)