add wat
This commit is contained in:
parent
27f543c75f
commit
deeb9792ba
3 changed files with 47 additions and 0 deletions
1
wat/README.md
Normal file
1
wat/README.md
Normal file
|
@ -0,0 +1 @@
|
|||
observe surprising things about programming languages.
|
31
wat/set-e.sh
Normal file
31
wat/set-e.sh
Normal file
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/env sh
|
||||
# run this shell script with one of these shells:
|
||||
# zsh, bash, dash, or (busybox) ash.
|
||||
set -e
|
||||
|
||||
# false # this exits the shell immediately.
|
||||
# false || false # this exits as well.
|
||||
false && true # wait, what?
|
||||
! true # huh?
|
||||
|
||||
fun() {
|
||||
false # this *should* cause, the shell to exit, right...?
|
||||
[ "$1" = 0 ]
|
||||
}
|
||||
|
||||
if fun 0; then echo wat 1; fi
|
||||
if false; then echo nope; elif fun 0; then echo wat 2; fi
|
||||
|
||||
i=0
|
||||
while fun $i; do i=1; done
|
||||
until fun $i; do i=0; done
|
||||
|
||||
# ! fun 0 # this exits zsh, and only zsh.
|
||||
# (! (! fun 0)) # this exits bash, and only bash.
|
||||
fun 0 && echo wat 3 || echo nope
|
||||
fun 1 && echo nope
|
||||
fun 0 || echo nope
|
||||
|
||||
echo aborting...
|
||||
fun 0 # let's get out of here.
|
||||
echo at least that works.
|
15
wat/upperlower.py
Normal file
15
wat/upperlower.py
Normal file
|
@ -0,0 +1,15 @@
|
|||
a = "ABCDEFGHIJKLMNOPQRSTUVWXYZÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞŸŠŒŽ"
|
||||
b = "abcdefghijklmnopqrstuvwxyzàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿšœž"
|
||||
|
||||
# try this for fun, if breaking things is fun to you:
|
||||
a += "ß"
|
||||
b += "ß"
|
||||
|
||||
print(a)
|
||||
print(b.upper())
|
||||
print(a.lower())
|
||||
print(b)
|
||||
|
||||
print("TEST:")
|
||||
print(a == b.upper())
|
||||
print(b == a.lower())
|
Loading…
Reference in a new issue