return a = “hello”; What will Happen?(www.ironshay.com)

submitted by shayfriedmanshayfriedman(1411) 2 years ago

I came across an interesting piece of code the other day, something I didn’t even know possible in C# - return a = "hello";. What do you think this line returns?

1 comment |category: |Views: 973

tags: another

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:
Comments:

posted by zychrzychr(1) 2 years ago 0

Shay,
It would first assign a to "hello" and then return "hello" because of the assignment operator's chaining effect (i.e. a = b = c = ...).
HTH,
zychr

Reply

information Login or create an account to comment on this story