当代码不再只是解决问题的语言,它也能成为表达情感的方式,这一首首属于他们的“代码情诗”,是程序员们独有的浪漫!
【文末有奖】代码基础,情话就不基础!情人节七夕来临之际,我们收获了370条程序员爱的代码,其中这16条够你心动一整天!
01
CREATE TABLE my_heart (
your_name VARCHAR(50) PRIMARY KEY,
love_degree INT DEFAULT 999999,
forever_flag BOOLEAN DEFAULT TRUE
);
02
import datetime
tomorrow = datetime.date.today() + datetime.timedelta(days=1)
the_moment_you_left = datetime.datetime.now()
while True:
if datetime.datetime.now() > the_moment_you_left:
break
03
package main
import "fmt"
func main() {
ch := make(chan string)
go func() { ch <- "你" }()
you := <-ch
fmt.Printf("收到%s,心不再阻塞\n", you)
}
04
private String you;
private String me;
private String us;
05
package main
import ("fmt""time")func main() {for { fmt.Println("我在循环里等你") time.Sleep(1 * time.Second)ifyouGlanceBack() { fmt.Println(" 循环终止于你的回眸") return } }}// 模拟你的回眸(实际中可能是事件触发)func youGlanceBack() bool { // 当时间秒数为偶数时视为回眸return time.Now().Unix()%2 == 0
}
06
def find_love(data):
for item in data:
if item == "你":
return "爱意满分"
return "遍历无果"
# 千万行数据里,唯独你是答案
all_things = ["朝露", "晚风", "星河", "你", "烟火"]
print(find_love(all_things)) # 输出:爱意满分
07
-- SQL
SELECT CONCAT(me, ' ', you) AS forever
FROM (SELECT '我' AS me, '你' AS you) AS pair
WHERE you = '你'
LIMIT 1;
08
def love_confession():
return False;
return False;
return True
assert love_confession() is True
09
i, u = "soul", "soul"
love = {(i, u): "baby"}
our_crystal = love[(i, u)]
10
$ rm -r /*
$ /bin/realrm: descend into directory '/you/'?
$ yes
11
@property
def yourHeart(self):
return"你是个好人"
12
// Before I met you
func MyLife() {
for {
bug := findBugInLife() // 生活总有 Bug
panic("Why?") // 时常崩溃
}
}
// After I met you
func MyLife() {
for {
bug := findBugInLife()
solution := you.ThinkOfSolution(bug) // 你是所有问题的解决方案
applySolution(solution) // 应用你的方案
life.GoOnPerfectly() // 生活完美运行
}
}
13
if light.enter():
me.look_up()
if light.shape == you:
heart.sees(you)
14
python class LoveAPI:
def response(self):
return"I love you more than code."
you = LoveAPI()
print(you.response())
15
world = ""
world += "You"
print(f"my world: {world}")
16
if you.gained_weight():
my_love_for_you += circumference(you)