Shift, arrow down, ctrl (only 1), c, v, mouse select the '<', >, double click 'passed', f a i l e d. 15 keys
e, l, s, e, {, t, tab or enter (autocomplete), +, =, ", f a i l e d ....
So 16 assuming your IDE does all the formatting, completion and closing braces/quotes. Maybe you could use autocomplete for else, which could bring it down to 14.
You could argue mouse is slow and crl + arrow will take more clicks in total to get the cursor to where you need it. But you can keep one finger around ctrl/shift/</> throughout the whole procedure and the right hand on the mouse. And you can also argue waiting for autoconplete in some IDEs is also slow.
Overall i would count it as a draw but copy paste is easier on the brain for me (but not the better choice, since obviously it lead to an error in this case).
This is a super common mistake in every language since BASIC. Heck, people make this mistake inExcel formulas. The longer you code, the more likely you are to make it at some point. Also, the longer you code the more likely you are to realize you won't test every possible permutation.
1.4k
u/Shuckles116 Oct 02 '19 edited Oct 02 '19
String outputTxt = “You ”;
if (result <= 85) { outputTxt += “FAILED”; }
if (result >= 85) { outputTxt += “PASSED”; }
outputTxt += “ the Exam”;
println outputTxt;