Skip to content

Commit 2af410b

Browse files
authored
!var to check undefined variable
1 parent fe3e460 commit 2af410b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ test ="test"
1212
=test.replace("test","")
1313
x = True
1414
print((x||False)?"Done":"Failed")
15-
print("Done") if x
15+
print('x is not defined') if !x
1616
```
1717
## Orginal Syntax
1818
```python
@@ -29,8 +29,8 @@ test ="test"
2929
test=test.replace("test","")
3030
x = True
3131
print("Done" if (x if 'x' in locals() else False) else "Failed")
32-
if x:
33-
print("Done")
32+
if 'x' not in locals():
33+
print('x is not defined')
3434
```
3535

3636
If you find this more complicated than original or more syntax should be added to it, feel free to edit YAML files with your preference

0 commit comments

Comments
 (0)