Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.scripting.vbscript > #11189

Re: Weird bug

From "R.Wieser" <address@not.available>
Newsgroups microsoft.public.scripting.vbscript
Subject Re: Weird bug
Date 2015-11-17 10:44 +0100
Organization Aioe.org NNTP Server
Message-ID <n2esui$616$1@speranza.aioe.org> (permalink)
References <n2d78f$639$1@dont-email.me>

Show all headers | View raw


Mayayana,

Evertjan is right, it works as designed.

Lets look at it from another angle, and regard the following: If a condition
is met, I want both X and Y to be set to Zero.   I would, and always have
written that as :

if condition then x=0: y=0

You on the other hand would be reading it as:

if condition then x=0:
y=0

To be more specific, you would not be able to write a one-line,
multy-command "then" ....

> as the same as a line return, simply used for formatting

Well, that is where you problem exists.   The line return terminates a
*line* (which can hold one or more commands), the colon only terminates a
single command.

> It works fine in VB6.

I strongly doubt that.  Using it predecessor (VB5) a line like:

if False then debug.print "1": debug.print "2"

prints neither the "1" nor the "2".

> I'm talking about the other use of colons -- to serve as
> line returns in order to write compact code

Suggestion: Do not try to take a feature on one programming language and
expect another one (even though deceptivly named almost the same) to adhere
to it.  Each language "does its own thing".   No ammount of "yes but ...."
will change anything to that I'm afraid.

Regards,
Rudy Wieser



-- Origional message
Mayayana <mayayana@invalid.nospam> schreef in berichtnieuws
n2d78f$639$1@dont-email.me...
> I just wasted hours before discovering this:
>
> x = -18
>
> x = x + 9: If x > 10 Then x = 10: If x < 0 Then x = 0
>
> MsgBox x
>
> '  Returns -9, but, this works:
>
> x = -18
>
> x = x + 9: If x < 0 Then x = 0
>
> MsgBox x
>
> Why? Is only one colon allowed? I've never noticed that
>
> problem before. It works fine in VB6.
>
>
>
>
>
>
>
>

Back to microsoft.public.scripting.vbscript | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Weird bug "Mayayana" <mayayana@invalid.nospam> - 2015-11-16 13:28 -0500
  Re: Weird bug "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-11-16 19:50 +0100
  Re: Weird bug "Dave \"Crash\" Dummy" <invalid@invalid.invalid> - 2015-11-16 15:28 -0500
  Re: Weird bug "Mayayana" <mayayana@invalid.nospam> - 2015-11-16 16:13 -0500
    Re: Weird bug "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-11-16 22:57 +0100
      Re: Weird bug "Mayayana" <mayayana@invalid.nospam> - 2015-11-16 18:10 -0500
        Re: Weird bug "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-11-17 01:20 +0100
          Re: Weird bug "Mayayana" <mayayana@invalid.nospam> - 2015-11-16 21:11 -0500
  Re: Weird bug "R.Wieser" <address@not.available> - 2015-11-17 10:44 +0100
    Re: Weird bug "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-11-17 11:19 +0100
      Re: Weird bug "R.Wieser" <address@not.available> - 2015-11-17 11:31 +0100
    Re: Weird bug "Mayayana" <mayayana@invalid.nospam> - 2015-11-17 09:06 -0500
      Re: Weird bug "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-11-17 15:24 +0100
        Re: Weird bug "Mayayana" <mayayana@invalid.nospam> - 2015-11-17 10:35 -0500
          Re: Weird bug "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-11-17 16:45 +0100
      Re: Weird bug "R.Wieser" <address@not.available> - 2015-11-17 17:13 +0100
        inline "End If" bug, was Re: Weird bug "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-11-17 17:41 +0100
          Re: inline "End If" bug, was Re: Weird bug "R.Wieser" <address@not.available> - 2015-11-17 18:27 +0100
            Re: inline "End If" bug, was Re: Weird bug "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-11-17 19:37 +0100
              Edsger Wybe Dijkstra was: Re: inline "End If" bug, was Re: Weird bug "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-11-17 19:44 +0100
              Re: inline "End If" bug, was Re: Weird bug "R.Wieser" <address@not.available> - 2015-11-17 20:47 +0100
        Re: Weird bug "Mayayana" <mayayana@invalid.nospam> - 2015-11-17 12:01 -0500
          Re: Weird bug "R.Wieser" <address@not.available> - 2015-11-17 18:47 +0100
  Re: Weird bug "R. Roesler" <worm.composter@nospam.arcornews.de> - 2015-11-19 13:12 +0100

csiph-web