The following are the conditional and loop functions you can use in COD scripts. In most cases, the syntax can be copied/pasted directly into a file and function properly. They should be edited for your particular use. This allows you to short cut your time by not having to experiment to figure out code syntax.

TypeExample
Do - Loop Until
dim count = 10
do
debug count
count = count - 1
loop until count = 0
Do Until - Loop
dim count = 10
do until count = 0
debug count
count = count - 1
loop
Do While - Loop
dim count = 5
do while count < 10
debug count
count = count + 1
loop
Do - Loop While
dim count = 5
do
debug count
count = count + 1
loop while count < 10
For – Next
dim mynum
for mynum=1 to 10
debug mynum
next mynum
For – Next – Step
dim mynum
for mynum=1 to 10 step 2
debug mynum
next mynum
If
dim mynum = 1
if mynum = 1 then
debug "Yes"
endif
If
(on one line only)
dim mynum = 1
if mynum = 1 then debug "Yes"
If - Else
dim mynum = 1
if mynum = 1 then
debug "Yes"
else
debug "No"
endif
If - Else
(on one line only)
dim mynum = 1
if mynum = 1 then debug "Yes" else debug "No
If – ElseIf - Else
dim mynum = 1
if mynum = 1 then
debug "1"
elseif mynum = 2 then
debug "2"
else
debug "Other"
endif
Select Case
dim mynum = 3
select mynum
case 1
debug "Doing 1"
case 2, 3
debug "Doing 2 & 3"
case 4
debug "Doing 4"
end select
Select Case Else
dim mynum = 3
select mynum
case 1
debug "Doing 1"
case 2, 3
debug "Doing 2 & 3"
case else
debug "Doing something else"
end select
While
dim loop = 1
while loop <= 5
debug loop
loop = loop + 1
endwhile