-
Notifications
You must be signed in to change notification settings - Fork 6k
space either side of ^ operator is significant #45761
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
Comments
@KlausLoeffelmann Looks like the requested fix is appropriate. Can you confirm? |
@KathleenDollard @KlausLoeffelmann On a related question, is whitespace significant around all operator tokens? If so, this should be a general fix |
Maybe the problem is not the documentation of ^, but rather implementation of the editor and Immediate Window.
At least in the case of the three tokens *+- the vba editor inserts whitespace around those tokens in a function but not in expressions in the immediate window (where the operation is completed as expected).
In the case of the caret ^ the vba editor does not insert whitespace around the token, and omitting whitespace on both sides is identified as an error:
Function test(a, b) As Single
test = a^b
End Function
If the whitespace is omitted only on the right in code, test = a ^b, the editor inserts the missing space and no error is flagged.
Then there's this strange behavior in the Immediate window:
[cid:1bac7f58-e7e7-45cf-9c2b-3011de0c40e2]
*
no space inserted around = or +
*
space inserted around ^ but operation not executed
*
unexpected dialog presented on entering ?b^a (declarations are typically unnecessary in Immediate window afaik).
…________________________________
From: Bill Wagner
Sent: Friday, April 18, 2025 6:52 AM
To: dotnet/docs
Cc: HelmZalee; Author
Subject: Re: [dotnet/docs] space either side of ^ operator is significant (Issue #45761)
[https://avatars.githubusercontent.com/u/493969?s=20&v=4]BillWagner left a comment (dotnet/docs#45761)<#45761 (comment)>
@KathleenDollard<https://github.com/KathleenDollard> @KlausLoeffelmann<https://github.com/KlausLoeffelmann>
On a related question, is whitespace significant around all operator tokens? If so, this should be a general fix
—
Reply to this email directly, view it on GitHub<#45761 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AJFSKD5HY36CIOOTFGAS56T22D7SPAVCNFSM6AAAAAB2Z3SWQ2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQMJVGQ4DSOBXGU>.
You are receiving this because you authored the thread.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Type of issue
Typo
Description
Surprised to get an error entering ?2^3 into the Immediate window, I went to the Documentation where I found "the syntax is number ^ exponent". It turns out the space either side of the caret is significant, as taken very carefully, that text says. Nonetheless, it would seem worth mentioning, as at least in my experience, spaces around an operator are rarely significant. Further down, the thing is shown in a gray background (
). Hard to be certain, but it doesn't look like the spaces are part of it. They should be.
Not sure what "type" of issue this should be...
Page URL
https://learn.microsoft.com/en-us/dotnet/visual-basic/language-reference/operators/exponentiation-operator
Content source URL
https://github.com/dotnet/docs/blob/main/docs/visual-basic/language-reference/operators/exponentiation-operator.md
Document Version Independent Id
2b3272c5-c7c5-a0f0-528d-47f37ca4e2a1
Platform Id
c1cec2d5-268b-276c-0527-6ae1f170cbbe
Article author
@KathleenDollard
Metadata
Related Issues
The text was updated successfully, but these errors were encountered: