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 8717487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:19:03+00:00 2026-06-13T06:19:03+00:00

This is from apple blocks docs and I am having difficulty understanding this please

  • 0

This is from apple blocks docs and I am having difficulty understanding this please can any one explain it

If you don’t explicitly declare the return value of a block
expression, it can be automatically inferred from the contents of the
block. If the return type is inferred and the parameter list is void,
then you can omit the (void) parameter list as well. If or when
multiple return statements are present, they must exactly match (using
casting if necessary).

  • 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-13T06:19:04+00:00Added an answer on June 13, 2026 at 6:19 am

    1) If you don’t explicitly declare the return value of a block expression, it can be automatically inferred from the contents of
    the block

    The block

    void ^(float aFloat) {
       printf("value is :%f",aFloat);
    };
    

    can also be written as

    ^(float aFloat) {
       printf("value is :%f",aFloat);
    };
    

    without saying the return type. The return type is automatically inferred. It is true for blocks that returning non void values.

    2) If the return type is inferred and the parameter list is void, then you can omit the (void) parameter list as well

    This is bit tough to understand and confusing, since documentation specifically saying

    A block that takes no arguments must specify void in the argument
    list.

    I believe this kind of blocks is possible.

     ^{
         printf("Hello world");
     }
    

    where return value is inferred, and because of that, a void is not needed. I am not sure about this, so would like some clarification.

    3) If or when multiple return statements are present, they must exactly match (using casting if necessary).

    Simply means, a block must return only one type of data. It can’t return an int and float.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this is from apple block programming , can anyone tell me what it means
This is unmodified code from Apple's iPhone 'Utility Aplication' template: - (void)applicationDidFinishLaunching:(UIApplication *)application {
I got the JSON from apple like this { original-purchase-date-pst = 2012-06-28 02:46:02 America/Los_Angeles;
Downloaded Reachability from Apple, using this method to check for an active connection: -(BOOL)isReachable{
Got this code for a viewscroller from the apple developers site. @synthesize scrollView1, scrollView2;
var fruit = [apple,pear,pear,pear,banana]; How do I remove all pear fruit from this array?
I'm interesting in creation of PushCertWebRequest (this is from apple documentation) I have found
I'm using Apple's SecKeyWrapper class from the CryptoExercise sample code in the Apple docs
From what I can tell, this has not been asked before. I am building
Can I create a Ruby Hash from a block? Something like this (although this

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.