I am trying to run some simple code via my Linux terminal that I wrote in Sublime Text 3.
There is no issue in my code, it looks like the following code:
# Some Initialization
while True:
if (i == 1):
# Do something
When I run the code via the terminal it won't reach the contents of the if
statement even when i == 1
is True
(I printed and checked that).
Is there some way to configure Sublime Text 3 to fix the issue?
For example, the following code won't enter the if
statement:
i = 1
print(i == 1) # it prints True on the terminal
if (i == 1): # the statement is True but won't enter the statement
print('Hello World!')
If the error is something regarding the variable i
, it is because you haven't initialised any value for i
.
You can initialise i
:
i = 0
before starting the while
loop.
If this is not the case, what is the detailed error message?
Try executing it inside sublime text 3 by going to tools>Build System>Python and then pressing Ctrl+B. I am not a 100% sure since I don't have Linux but this might work
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.