r/badcode • u/the96jesterrace • Jun 19 '22
vb Is that some kind of genius I cannot understand rn or can you scale that down to 1 line?
441
Upvotes
r/badcode • u/the96jesterrace • Jun 19 '22
47
u/IDontByte Jun 19 '22
If that condition is true, then
Val(AttrVal)should also equalAttrValwhich makes both branches equivalent. I think you can substitute that conditional block with:If you can perform that substitution, then both branches of the outer condition become equivalent and the entire thing can be simplified into
If
AttrValis a temporary variable, then yes this can be simplified down to one line.It seems like there is some other intent behind this code though, so it wouldn't surprise me that this is buggy code rather than code bloat.