If then and goto statements

I am using a sub program to weld multiple parts. I am doing a part search to verify that the part is there, if it is not I want to just jump to the end of the sub program to skip the part and continue with the next part. I believe I need to use a goto statement but I’m not sure what it should look like and I can’t find any examples.

goto sounds like an assembly / low level expression, and I don’t remember ever seeing that on higher level languages, and I think URScript is a high one.

But why not use an if statement then?

ROBOT_PROGRAM

# start 
moveJ(Start_position)

# part 0
part0_is_there = get_standard_digital_in(0)
if part0_is_there:
moveL(welding0_point1)
moveL(welding0_point2)
...
end

# part 1
part1_is_there = get_standard_digital_in(1)
if part1_is_there:
moveL(welding1_point1)
moveL(welding1_point2)
...
end

# keep repeating for all the possible parts
1 Like