#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default 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.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
lookup with multiple condition, but one condition to satisfy is en Eddy Stan Excel Worksheet Functions 2 October 27th 07 02:06 PM
Combine an OR condition with an AND condition Will Excel Discussion (Misc queries) 1 April 6th 07 03:52 PM
Max or Min with condition Marc Excel Worksheet Functions 2 May 24th 06 10:08 PM
Condition 1 overules condition 2? Bultgren Excel Worksheet Functions 2 January 20th 06 12:29 PM
I need 4 condition for condition formatting SeeKY Excel Programming 2 June 7th 05 09:41 AM


All times are GMT +1. The time now is 06:37 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"