Code: Select all
FileRead,v2,C:\Users\ADMIN\Desktop\New Text Document.txt
for k, v in b:= StrSplit(v2, "`n")
{
if (k = b.MaxIndex()-1)
{
t.= v
Break
}
else
t.= v "`n"
}
msgbox % t
I want to replace if else statement with ternary operator and for this i tried this-
Code: Select all
FileRead,v2,C:\Users\ADMIN\Desktop\New Text Document.txt
for k, v in b:= StrSplit(v2, "`n")
(k = b.MaxIndex()-1)?(t.=v, Break):(t.=v "`n")
msgbox % t
In the above red box of the image you can see that I am trying to assign the value of v into variable t as well as break the loop at the very same time. I think I am unable to code the red marked part of the above codes correctly. Please tell me how we can perform two tasks in ternary operator, like assigning the value of a variable into other variable and at the same time breaking the loop? Please help. Thanks..