A
A
Artyom2019-01-30 23:04:32
VBScript
Artyom, 2019-01-30 23:04:32

How to make multiple conditions in one if in vbs?

I have several variables
apelsin = yes
mandarin = yes
jabloko = no
grusha = yes
How can I make such a check?: If at least one with variables = yes then display
MsgBox "Fruits found"
If all variables are = no then
skip code with MsgBox Suggested
this code

a = no
m = no
j = no
g = no


if a=yes or m=yes or j=yes or g=yes then
MsgBox "est frukti"
else
MsgBox "fruktov net"
End If

I guessed something like this, but for some reason, according to the logic of things, the first window should not have been opened, since all variables = no , but I still observe "est frykti" . What have I done wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
NIXBeDMaN, 2021-02-08
@NIXBeDMaN

put quotes
a = "no"
m = "no"
j = "no"
g = "no"
if a="yes" or m="yes" or j="yes" or g="yes" then
MsgBox "est frukti"
else
MsgBox "fruktov net"
End If

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question