this isnt about parsing args or using modules lol, also i forgot to do a commit that attempts to explain things better in example.py, should be up to date.
heres what is happening:
val = int(sys.argv[1]) if int(sys.argv[1]) else fallthrough
1. val will be converted into an int
IF
The supplied arg is indeed an int. any type that is not an int will fail otherwise
IN WHICH CASE
fallthrough to the next case, which handles the event now.
It's error handling with a single word. And when you supply this program with a zero, it will just not make any matches, which isn't an error at all. the program is running as expected.
Look people, i didnt invent the idea, ken thompson (you know the guy that cowrote UNIX and C) did, so i guess if you're smarter than ken thompson, sure. this doesnt make any sense.
heres what is happening:
val = int(sys.argv[1]) if int(sys.argv[1]) else fallthrough
1. val will be converted into an int
IF
The supplied arg is indeed an int. any type that is not an int will fail otherwise
IN WHICH CASE
fallthrough to the next case, which handles the event now.
It's error handling with a single word. And when you supply this program with a zero, it will just not make any matches, which isn't an error at all. the program is running as expected.
Look people, i didnt invent the idea, ken thompson (you know the guy that cowrote UNIX and C) did, so i guess if you're smarter than ken thompson, sure. this doesnt make any sense.