What is the difference between assignment and comparison in VBScript?

AI Thread Summary
The discussion centers on creating a linear programming solution that visualizes equations graphically for two-variable inputs and presents solutions in a table format for three or more variables. The user seeks assistance in developing source code in Visual Basic (VB) or algorithms for this optimization task, which involves either minimization or maximization. A participant suggests using VBScript embedded in a Visual Basic program to solve the equations, highlighting the use of the Eval function for evaluating expressions. The conversation also touches on the interpretation of assignment and comparison in VBScript, clarifying how the Eval method differs from the Execute statement. An example is provided to illustrate the use of the Eval function in a guessing game scenario.
fida
Messages
3
Reaction score
0
hello,
i want to make a linear program which has such this conditional:
if the inputs have 2 variables (ex. x & y) and make equations (ex. 2x + 3y <= 23, 5x + y <= 12) then both equation will shown in graphic.
but if the inputs have more than 2 variables (ex. x, y & z) and have some equations then the solution shown in table.
both programs are optimization case (minimization or maximization).
can anyone help me in making the source codes in vb and/or the algorithms? i really need it, pls! if u have the info feel free to send me an email to fida_nich@hotmail.com
tq
 
Technology news on Phys.org
Hi
This is very tedious job to solve the equation in the generic programming language
So please use the vb script embedded in the visual basic program to solve the equation

Systax :

[result = ]Eval(expression)
Arguments result Optional. Variable to which return value assignment is made. If result is not specified, consider using the Execute statement instead.
expression Required. String containing any legal VBScript expression.


Regards,
Rahul
 
Fida

In VBScript, x = y can be interpreted two ways. The first is as an assignment statement, where the value of y is assigned to x. The second interpretation is as an expression that tests if x and y have the same value. If they do, result is True; if they are not, result is False. The Eval method always uses the second interpretation, whereas the Execute statement always uses the first.

Note In Microsoft® JScript™, no confusion exists between assignment and comparison, because the assignment operator (=) is different from the comparison operator (==).
The following example illustrates the use of the Eval function:

Sub GuessANumber
Dim Guess, RndNum
RndNum = Int((100) * Rnd(1) + 1)
Guess = CInt(InputBox("Enter your guess:",,0))
Do
If Eval("Guess = RndNum") Then
MsgBox "Congratulations! You guessed it!"
Exit Sub
Else
Guess = CInt(InputBox("Sorry! Try again.",,0))
End If
Loop Until Guess = 0
End Sub
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I had a Microsoft Technical interview this past Friday, the question I was asked was this : How do you find the middle value for a dataset that is too big to fit in RAM? I was not able to figure this out during the interview, but I have been look in this all weekend and I read something online that said it can be done at O(N) using something called the counting sort histogram algorithm ( I did not learn that in my advanced data structures and algorithms class). I have watched some youtube...
Back
Top