« Previous Next »

Thread: What the meaning of colon sign ":" in asp syntax?

Last post 04-24-2006 11:43 AM by aaaa0441. 4 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (5 items)

Sort Posts:

  • 04-21-2006, 4:55 AM

    • aaaa0441
    • Not Ranked
    • Joined on 02-10-2006, 6:18 AM
    • Posts 0

    What the meaning of colon sign ":" in asp syntax?

    I found the following asp code with colon sign ":" used. Is it any special type of variable declaration or initialization? Anyway, what's the use of it?

    ' Initialize common variables
    x_CompanyID = Null: ox_CompanyID = Null
    x_CompanyName = Null: ox_CompanyName = Null
    x_ROC = Null: ox_ROC = Null
    x_PostalAddress = Null: ox_PostalAddress = Null
    x_WebsiteAddress = Null: ox_WebsiteAddress = Null

  • 04-21-2006, 9:25 AM In reply to

    • tomkmvp
    • Top 10 Contributor
    • Joined on 03-20-2003, 10:27 AM
    • Central NJ
    • Posts 6,079
    • IIS MVPs

    Re: What the meaning of colon sign ":" in asp syntax?

    It just allows you to put a second set of commands on the same line.
  • 04-22-2006, 12:48 AM In reply to

    • aaaa0441
    • Not Ranked
    • Joined on 02-10-2006, 6:18 AM
    • Posts 0

    Re: What the meaning of colon sign ":" in asp syntax?

    Thanks, man.

    So we can use colon sign to merge as many lines as we want into one line in ASP?

  • 04-24-2006, 8:49 AM In reply to

    Re: What the meaning of colon sign ":" in asp syntax?

    Yeah.

    eg:

    x_CompanyID = Null: ox_CompanyID = Null: x_CompanyName = Null: ox_CompanyName = Null: x_ROC = Null: ox_ROC = Null: x_PostalAddress = Null: ox_PostalAddress = Null: x_WebsiteAddress = Null: ox_WebsiteAddress = Null

    Is the same as (and if you like, should normally be):

    x_CompanyID = Null
    ox_CompanyID = Null
    x_CompanyName = Null
    ox_CompanyName = Null
    x_ROC = Null
    ox_ROC = Null
    x_PostalAddress = Null
    ox_PostalAddress = Null
    x_WebsiteAddress = Null
    ox_WebsiteAddress = Null

    In this case it's quite understandable why the code writer has used several code lines in a single line, but its not a recommended approach to keep your code clean and overseeable. If you're a C++, pascal or PHP programmor, a colon in ASP is the same as a semicolon in these other languages for multiple code statements on a single line.

  • 04-24-2006, 11:43 AM In reply to

    • aaaa0441
    • Not Ranked
    • Joined on 02-10-2006, 6:18 AM
    • Posts 0

    Re: What the meaning of colon sign ":" in asp syntax?

    Thank you. ^_^
Page 1 of 1 (5 items)