if the code fragment were executed (conditional sentences)

< Previous | Next >

AntiScam

Senior Member
Arabic
Hello,
In the sentence below, I'd like to see if "were executed" is correct and if it sounds acceptable to the native ear.

What would the output be, e.g. on the computer screen, if the code fragment below were executed?
a=5
b=2
c=a+b
print c
Edit:
The reason I'm asking is that it didn't sound as good as

What would the output be, e.g. on the computer screen, if the code fragment below were to be executed?
 
Last edited:
  • e2efour

    Senior Member
    UK English
    The use of were to be executed may make some people think that this is rather unlikely to happen.

    But if you are talking about computer outputs for possible operations or operations that are going to happen, were executed is fine. It is also ok to write was executed.
     

    entangledbank

    Senior Member
    English - South-East England
    I'd say 'was executed' for that, as there's no reason it shouldn't be. 'Were' is for unusual hypotheticals. In computer programming, this might apply to a "can't happen" situation: that is, if you get to that point, you're in trouble, because there should be no way you could get there, so what unexpected thing has happened? Then you explore various possibilities: if c were previously defined as a string, etc.
     
    < Previous | Next >
    Top