討論串[閒聊] 不使用if的寫法
共 18 篇文章

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者azureblaze (AzureBlaze)時間12年前 (2013/01/08 13:42), 編輯資訊
0
0
0
內容預覽:
C++:. template<int>. class YesNo{. public:. static void print(){. printf("no");. }. };. template<>. class YesNo<1>{. static void print(){. printf("yes
(還有43個字)

推噓3(3推 0噓 1→)留言4則,0人參與, 最新作者changyuheng (張昱珩)時間12年前 (2013/01/08 11:58), 編輯資訊
0
0
0
內容預覽:
Python 2.7. i = 1. print 'yneos'[any([i-1])::2]. --. 發信站: 批踢踢實業坊(ptt.cc). ◆ From: 36.224.181.231.

推噓2(2推 0噓 2→)留言4則,0人參與, 最新作者dryman (dryman)時間12年前 (2013/01/08 10:49), 編輯資訊
0
0
0
內容預覽:
不懂這題目的目的?. 前面推文有正解,是用array index. 不過還是要來惡搞一下,符合題意但在組語上看來差不多的東西:. int flag = 1; // or 0. while (flag) {. printf("yes\n");. goto END;. }. printf("no\n")

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者yauhh (喲)時間12年前 (2013/01/08 09:55), 編輯資訊
0
0
0
內容預覽:
真要講任何語言,那就會遇到語言語意的差異了. 語意差很大也沒關係嗎?. 要是Prolog,就是給一則邏輯式.. judge(1, 'yes').. judge(N, 'no') :- N =\= 1.. 不過這是廢話,邏輯中最基礎部份本來不需要if,除非P->Q被認為與if意義相同.. 所以想要反問

推噓0(0推 0噓 4→)留言4則,0人參與, 最新作者saplayer (saplayer)時間12年前 (2013/01/07 21:29), 編輯資訊
0
0
0
內容預覽:
python:. i = 1. print(i==1 and "yes" or "no"). --. 發信站: 批踢踢實業坊(ptt.cc). ◆ From: 140.112.28.171. 編輯: saplayer 來自: 140.112.28.171 (01/07 21:43).