Two conditions in which I want to run the same code
Hey everyone,
I have a script which does some stuff with time ( HH:MM format) where its important to check that the entered start time is before the end time. (because.. you know, time)
This is the jest of what I have;
if (hour start > hour end)){
// ERROR: start later than end
}else if(hours are equal)){
// check if minutes are entered correctly
if (minutes start>minutes end)){
// ERROR: start later than end
}else{
// Time was entered correctly, start
}}else{
// Time was entered correctly, start
}
So basically I have two conditions in which I want to run the same code; I reckon I can solve this by using a state variable but was wondering if there was perhaps another way (i.e. a goto line or perhaps a function in a function, is there such a thing?) I got the feeling those might be unnecisarily complicated so perhaps theres an easyer way to do this. (I've done some attempts at using the date.objects but couldnt get the util.scand to work with the HH:MM format
Any suggestions?
Thank you in advance for any trouble to be taken
