Sry to ask a simple doubt here, but i am in a desparate need for a solution.
I am writing a routine (Transform)
The folloing code is working fine
Routine 1
=======
Ans=""
Name="ABCD"
If (Name Match "0N") Then Ans= Name Else Ans=""
Return(Ans)
But the following is not working
Routine 2
=======
Ans=""
Name="ABCD"
If (Name Match "0N") Then
Ans= Name
Else
Ans=""
Return(Ans)
Wht is the problem here? I want to give multiple statements if the condition is true but it is not allowing me to do the second routine.
Can anyone help?
If Else problem
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
If "Then" or "Else" is the last word on its line then it opens a block of statements that must be terminated by an End statement.
or equivalently,
This is called "multi-line format" of the IF statement.
Code: Select all
Ans=""
Name="ABCD"
If (Name Match "0N") Then
Ans= Name
End
Else
Ans=""
End
Return(Ans)
Code: Select all
Ans=""
Name="ABCD"
If (Name Match "0N")
Then
Ans= Name
End
Else
Ans=""
End
Return(Ans)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Premium Member
- Posts: 238
- Joined: Fri Jul 25, 2008 8:55 am