Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8223215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T14:36:36+00:00 2026-06-07T14:36:36+00:00

I know that Instance methods can return a value when they are done executing,

  • 0

I know that Instance methods can return a value when they are done executing, but I do not know how to set & get that value, I know how to set the parameters but how do I set the return type of Method itself?

So, this is the Instance method implementation:

-(int) returnInteger: (id) anString: (int) anNumber{

to set it´s parameters i do:

 [self returnInteger: (id) returnNSString: (int) 100]; 

But how do I set the value of “returnInteger itself” I want to know how to set i both inside it´s implementation and when I call it (when it executes).

also – one more question

if I set it´s first parameter to be 100 inside the method, and when I call it I want to add 100 to it, how do i do that? i tried this -but did not work

[self returnInteger: (id) returnNSString: (int) + 100]; 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T14:36:41+00:00Added an answer on June 7, 2026 at 2:36 pm

    I’m still not really sure what you’re asking, but here’s an example that may be helpful.

    @interface Juniper : NSObject
    // Return type int, first parameter type NSString * and named s,
    // second parameter type int and named i. Method's name is
    // addNumberInString:toInt:
    - (int)addIntInString: (NSString *)s toInt: (int)i;
    @end
    
    @implementation Juniper
    
    - (int)addIntInString: (NSString *)s toInt: (int)i
    {
        // Extract int from argument named s
        int intFromString = [s intValue];
        // Add that int to argument named i and end 
        // method, returning the result of addition
        return intFromString + i;
    }
    
    @end
    
    
    
    int main(int argc, const char * argv[])
    {
    
        @autoreleasepool {
    
            Juniper * j = [[Juniper alloc] init];
            // Execute the method, store the return value
            int result = [j addIntInString:@"100" toInt:15];
            // Display the return value so we know it worked.
            NSLog(@"%d", result);
    
        }
        return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to pass an ImageIcon instance by value as we know that by
I want get the return value class of an instance in runtime. The thing
What I want is a memoization decorator that: can memoize instance methods with both
I know that, in Delphi, instance variables and global variables are initialized to zero
For instance, I know that basically all languages that are object oriented based are
I know that I can forward messages to instances of a class using -forwardInvocation:
I know that Phonegap has an event for back button, but it's only available
I know that this sort of question has been asked here before, but still
I know that Java have its own garbage collection, but sometimes I want to
I know that I can pass object values through a URL pattern and use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.