Skip to content
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

Vba- Js conversion : Issue on converting into Bitwise operators #2

Open
GoogleCodeExporter opened this issue Mar 16, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

Enter the following VB script code to convert

  Dim a As Integer
  a = 10:
  temp = 10 And 20
  temp = a Or 10

  Actual Js :
                   var a; // Integer
                   a = 10;

                   temp = 10 && 20;
                   temp = a || 10;

  Expected Js:
                   var a; // Integer
                   a = 10;

                   temp = 10 & 20;
                   temp = a | 10;

  Note : In Vba the AND, OR and XOR functions as boolean operator as well as bit wise operator. 
FYI http://visualbasic.about.com/od/usingvbnet/l/bldykand_or_not.htm

=======

The same issue is applicable While converting Boolean operators

  Try converting this Vba to Js
     e = 23 > 67 Xor 11 > 8
     f = 23 > 14 Xor 11 > 8
     g = 14 > 23 Xor e
     g = e Xor 11 > 8
     g = e Xor f

  Actual Js :
     e = 23 > 67 ^ 11 > 8;
     f = 23 > 14 ^ 11 > 8;
     g = 14 > 23 ^ e;
     g = e ^ 11 > 8;
     g = e ^ f;

     Note : '^' is a bitwise operator in Js

  Expected Js; Since Js does not have 'Xor' operator or it's equivalent, we can create a login to 
build 'Xor' functionality. Hope this link may helpl 
http://www.howtocreate.co.uk/xor.html
                      if( ( foo && !bar ) || ( !foo && bar ) ) {
                        ...
                      }

Original issue reported on code.google.com by nikhilsi...@google.com on 16 May 2010 at 5:58

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant