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

The Archive Base Latest Questions

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

Working with legacy code I came across some strange variable assignments that I am

  • 0

Working with legacy code I came across some strange variable assignments that I am not sure are legal VB6 syntax, but I cannot find the documentation to back up the feeling.

Dim ComStart, ComEnd, CR As Boolean
ComStart = ComEnd = CR = False

My suspicions are

a) the original declarations should be

Dim ComStart as Boolean, ComEnd as Boolean, CR as Boolean

b) the declarations as they are implemented now will not assign anything to ComStart.

Any answers or documentation are much appreciated

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

    The code you have found is technically legal VB6, because it compiles and runs. But it is very likely that the original author thought the code would do something different! There are two misunderstandings.

    • ComStart and ComEnd and CR are variants, not Booleans.
    • In VB6 = is the equality operator, not the assignment operator found in C.
      • CR = False does not change the value of CR. It compares the current value of CR to False, and evaluates as True if CR is equal to False. Let’s say it evaluates as False
      • Now you have the expression ComEnd = False. Again, this does not change the value of ComEnd. It compares it with False, and evaluates as True if ComEnd is equal to False. This time let’s say it evaluates as True.
      • Now you have the assignment statement ComStart = True. This sets the value of ComStart to True

    So your original code

    Dim ComStart, ComEnd, CR As Boolean
    ComStart = ComEnd = CR = False
    

    Creates two variants ComStart and ComEnd and a Boolean CR, and then

    • CR keeps its default value, False
    • ComEnd keeps its default value, Empty
    • ComStart is set to False because Empty = (Empty = False) is False.

    Simple! … I hope the rest of the legacy code is less, well, accidental.

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

Sidebar

Related Questions

I'm working updating some legacy code that does not properly handle user input. The
I'm working with some legacy code and I came across a function which is
I am working on some legacy code and have come across something that I'm
I'm working on some legacy code and I ran into something that I'm not
Working in some legacy code, I've run across a ton of Try/Catch statements. Try/Catch
I'm working with some legacy code that has an import like so: #import C:\Program
I'm working with legacy code that uses some convoluted logic to bind IN and
I'm working on some legacy code that uses win32 WriteFile() to write to a
For the past year I've been working on some legacy code that was written
I'm working with some legacy code that makes extensive use of this kind of

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.