Trouble making IF statement process Conditionals

Hello, I am trying to make a script that sets the values of multiple pipe expansion loops based on the size of the previous one (think Russian dolls). The expansion loops are revit families that size themselves properly based on the proper formulas. However to nest them I need to override those sizings. The math all makes sense to me and should be right, but I know I am messing up on how I am feeding the conditionals into the IF statement. It seems like the script is pedering out before it gets to this formula. I am testing it to just run Loop 1 and Loop 2 right now, thats why is everything else is frozen. Please advise. thanks!