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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:58:57+00:00 2026-06-10T19:58:57+00:00

Why is this working as expected: list.ForEach(sub(x) x.Name = New Name) But this isn’t:

  • 0

Why is this working as expected:

list.ForEach(sub(x) x.Name = "New Name")

But this isn’t:

list.ForEach(function(x) x.Name = "New Name")

Anyone else confused?

  • 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-10T19:58:59+00:00Added an answer on June 10, 2026 at 7:58 pm

    List(Of T).ForEach takes as an argument an Action (Sub) that doesn’t return a value not a Func (Function) that does return a value.

    In VB the = sign is ambiguous. It can either be used for comparison or assignment. As a result to disambiguate the statement, x.Name = "New Name" the team used the indicator Sub or Function to identify if this is a comparison or assignment. In the case of Sub(x) x.Name = "New Name", you are performing an assignment, or set the value of x’s Name parameter to “New Name”. In the case of Function(x) x.Name = New "Name" you are doing a comparison and returning if the Name parameter of x is the same as “New Name”. As a result, you have to be careful when you use Sub and Function.

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

Sidebar

Related Questions

I feel a bit stupid but this is not working (and I expected it
Has anyone got this working in a web application? No matter what I do
Strangely I had this working before but I reinstalled my system, upgraded to w7
I currently have this working but it requires me to have a static method
If I run this operation on List<Integer> for example, it works as expected (removes
I have this function: template <typename T> List<T>::ListNode *List<T>::find(int index) const { if (
Had this working; at one stage. The problem is the following text is now
Update: Got this working by disabling CodeIgniter Profiler which was interfering with the Ajax
I have this (working) CPU code: #define NF 3 int ND; typedef double (*POT)(double
I had this working at some point, as I had a question about 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.