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

Ruby

creating a property

Hi, I am watching the video, creating a property. in the vide an error is created by adding [predictionArray count]; , I am not getting this error at all and my Xcode layout looks different. Please see code: Ps, isit ok to post this amount of code??

//
//  ViewController.m
//  Crystal Ball
//
//  Created by karl on 12/03/2013.
//  Copyright (c) 2013 www.responsivewebdesign.ltd.uk. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    [predictionArray count];

    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)buttonPressed:(UIButton *)sender {
    NSArray *predictionArray = [[NSArray alloc] initWithObjects:@"It is certain",@"It is decidedly so", @"All signs say yes",
                       @"the stars are not allignrd",
                       @"My reply is no",
                       @"It is doubtful",
                       @"Better not tell you now",
                       @"Concentrate and ask again",
                       @"Unable to answer now",nil];




    self.predictionLabel.text = [predictionArray objectAtIndex:9];
}
@end

2 Answers

Amit Bijlani
STAFF
Amit Bijlani
Treehouse Guest Teacher

It is completely okay to put code just make sure you add code formatting syntax like this:

```objective-c
 // your code
```

You are probably not getting an error because you declared predictionArray as a property within your header file "ViewController.h".

Thankyou