Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CPN-3.1 用例示范 #4

Open
lg6s opened this issue Nov 2, 2018 · 1 comment
Open

CPN-3.1 用例示范 #4

lg6s opened this issue Nov 2, 2018 · 1 comment

Comments

@lg6s
Copy link
Member

lg6s commented Nov 2, 2018

结合了 CPN-1 #1 和CPN-2 #3

//typescript
Greeter:
    greeting-str
    [消息-str:  -greeting ← 消息

    greet:"Hello, " + -greeting

g ← + Greeter "world"

按钮 ← document`createElement 'button'
按钮/textContent ← "Say Hello"
       /onclick→    alert g.greet()

document`body`appendChild 按钮
//dlang
+ std/stdio array algorithm

∅ main:
    stdin> byLineCopy / array / sort[a→b] // writeln
@4b5ent1
Copy link

4b5ent1 commented Nov 2, 2018

//haxe
测试: 
	= 
		甲:
			名字 "Simn"
			出拳 出`布
		乙:
			名字 "Nicolas"
			出拳  出`石头
        
		赢家 = ∇ 甲 乙 /出拳
		   出/> 剪刀, 布: 甲
			>石头, 剪刀: 甲
			>石头,布:甲
                        > X=Y: 无 # 平局
                        ~=:乙
		 赢家 ≠ 无 √
			trace 'The winner is: ${赢家`名字}'
		~
			trace 'Draw!'

✤ 出[ 石头 = 1,布 = 2,剪刀 = 3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants