vbscript minus operator marked as invalid character [closed] - vbscript

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
I have a very simple equation in vbscript/asp. I get error on minus operator. I even had to add 0 in start of equation because I got same error at first one too.
y = 0 - (0.0114 * (x^2)) − (0.2396 * x) + 112.57
Microsoft VBScript compilation error '800a0408'
Invalid character
y = 0-(0.0114 * (x^2))-(0.2396 * x)+112.57
----------------------------^

The character between the x^2)) and the (0.2396 does not look like the character between the 0 and the (0.0114. It is likely an en dash, not a minus/hyphen. Fix that. Do not use Word or other word processor for creating code; the smart replacement of dashes and quotes will cause problems with code. Use a text editor like Notepad or Notepad++ instead.

Related

unexpected tidentifier expecting keyword_end [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
I've got a problem in Ruby, "unexpected tidentifier expecting keyword_end", how Can I solve it?
def riko(user)
if user.name.eql? 'Mia Khalifa Fan'
#client.send_msg 'Hola Mia <3 ¿Cómo te trato este dia, cosa guapa y sensual?',
else
if user.mame.eql? 'Skul Goy'
#client.send_msg 'Muerete. '
else
#client.send_msg "Hola #{user.name} o/ \ :v / "
end
end
You're using else if which works fine in other languages, but in Ruby represents 2 distinct conditionals. You probably want to replace it with elsif instead, which is the Ruby equivalent.

How to get all decimal points in in ruby? ( HOLD) [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
The following shows that when I use the to_f method to covert a string to a floating point number and the last decimal point is dropped. How can preserve all decimal points in a given number?
irb(main):002:0> value='1.7.8'
=> "1.7.8"
irb(main):003:0> value.to_f
=> 1.7
Some context:
I am writing the the value to a file and If I write it as a string I get the quotes '1.7.8'. What I am looking for infact is 1.7.8. Hope that makes sense.
EDIT:
I see the error in my question so I'm trying to close it however I can only vote to close it.
just to clarify what I've found is actually contrary to what I said above.
turns out if I write the string '1.7' to a file it is written as '1.7' but with the string '1.7.8' it is written as 1.7.8. I'm just trying to understand why this is occurring.
To write it to a file simply write it like so:
value = "1.7.8"
File.open("file") { |f| f.puts("#{value}") }
The string in the file will not have quotes around it.

< > inside a Ruby String [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
Improve this question
I was reading something else posted by a user on here explaining how yield statements work in Ruby. Part of the code he was using was :
print_list( [1,2,3], 23 ) { |n| "<#{n}>"}
what do the < > mean inside the string? It's such a simple question but I haven't been able to find out the answer to it.
In a string literal neither < nor > have any implied meaning - although such might have meaning in the output or use of the resulting string.
Only escape sequences and # (in interpolated literals) have intrinsic meaning.
These characters are just a part of string.
And any character which lies inside #{ } will be evaluated, which is also referred to Interpolation

PLS-00103 Encountered the symbol " " error in CASE [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I have simply written CASE statement in the procedure as below
(case when (T1.DEVICEHOLD = 'Z1' or T2.ISHOLD = 1) then 1
else 0
END) AS HOLD
But when I'm compling procedure its giving an error Compilation errors for PACKAGE BODY
Error: PLS-00103: Encountered the symbol "Z1" when expecting one of the following:
* & = - + ; at in is mod remainder not rem
or != or ~= >= and or like LIKE2_
LIKE4_ LIKEC_ between || multiset member SUBMULTISET_
The symbol "* was inserted before "Z1" to continue.
Could anyone help me to resolve this?
Thanks in advance!
This is a compiler error. The most likely cause is a stray ' somewhere which means that the first ' in your snippet terminates a quoted string and so the compiler considers Z1 to be code, and not valid as such.
The easiest way to spot such things is to use a decent editor or IDE which has syntax highlighting. These tools colourize quotes, keywords and comments and so make it easy to spot where we have made our bloomers. There are plenty of free tools available: Notepad++ or Oracle SQL Developer are popular options.

Swap two strings 2 by 2 in ruby [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 8 years ago.
Improve this question
I've go a string made in this way.
"AABBCCDD....." grouped by 4 with variable lenght.
I need a method that swap that 2 by two the chars in this string
def swap2_by_2( string )
???
end
If the input is AABBCCDD the output will be BBAADDCC
Thanks, i'm very noob in ruby.
Edit: my mistake, a more comprhensive example may be.. Input: ABCDEFGH -> CDABGHEF
It is not clear what the OP is trying to do, but if it is to flip the first and the second characters with the third and fourth characters for every four characters, then the example that the OP showed is highly misleading and inappropriate (It should have been "ABCD..." instead of "AABB..."). In that case, a solution would be:
string.gsub(/(..)(..)/, '\2\1')
Thinking about your question, an interpreting the "ABCDEF", I am sure, that you are looking for pack / unpack in Ruby: I found a good page here How to change bit order in Ruby
And here are two a non-regexp versions:
p 'AABBCCDD'.chars
.each_slice(2)
.each_slice(2)
.map(&:reverse)
.join
#=> "BBAADDCC"
# or
'AABBCCDD'.chars
.each_slice(4)
.map{|x| x.rotate(2)}
.join

Resources