Re: tidying up code - tips?
Posted: Mon Aug 26, 2013 5:02 am
Yep.EDIT: How do you know which "case" corresponds to which "condition" in the example I gave? Is it as simple as: case 1 = condition 1?
Questions and answers about the LiveCode platform.
https://forums.livecode.com/
Yep.EDIT: How do you know which "case" corresponds to which "condition" in the example I gave? Is it as simple as: case 1 = condition 1?
Code: Select all
if condition = 1then
if item 1 of line x of data = "test" then
if item 7 of line x of data = 1 then
#STUFF
else if item 7 of line x of data = 3 then
# STUFF
end if
else if item 1 of line x of data = "XYZ" then
#Stuff
end if
else if condition = 2 then
if item 1 of line x of data = "test" then
if item 7 of line x of data = 1 then
....
Code: Select all
switch condition
case 1
switch item 1 of line x of data
case "test"
switch item 7 of line x of data
case 1
#STUFF
break
case 3
# STUFF
break
end switch -- item 7 of line x of data
case "XYZ"
#Stuff
break
default
-- do stuff here to catch item 1 not being "test" or "XYZ"
break
end switch -- item 1 of line x of data
case 2
switch item 1 of line x of data
case "test"
switch item 7 of line x of data
....
end switch -- item 1 of line x of data
end switch -- condition