ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   condition (https://www.excelbanter.com/excel-programming/368372-condition.html)

[email protected]

condition
 

if(some condition)
print("hello");
else
print(world");

the ans should be hello world.

my question is what is the condition so that the ans is hello world.


NickHK

condition
 
SomeCondition will evaluate to either True or False, not both, so from your
code it is not possible to print "Hello World" for any value of
SomeCondition. But...
Assuming you are working in VBA:

If SomeCondition Then
Debug.Print "Hello World"
Else
Debug.Print "Condition is False"
End If

NickHK

wrote in message
ups.com...

if(some condition)
print("hello");
else
print(world");

the ans should be hello world.

my question is what is the condition so that the ans is hello world.




Norman Jones

condition
 
Hi Malar,

To give a banal example:

'=============
Public Sub Tester0031()
Dim msg As String
Dim a, b, c

a = 3: b = 2: c = 1

If a b And b c Then
msg = "Hello world"
ElseIf a b Then
msg = "Hello"
ElseIf b c Then
msg = "World"
Else
msg = "Some other message"
End If

MsgBox msg

End Sub
'<<=============


---
Regards,
Norman



wrote in message
ups.com...

if(some condition)
print("hello");
else
print(world");

the ans should be hello world.

my question is what is the condition so that the ans is hello world.





All times are GMT +1. The time now is 07:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com