文章出處

1.用@可以不用寫轉義字符。如文件路徑,可以不用寫兩個反斜杠,即忽略轉義

2.可以讓字符串跨行。

 1 string script = @"
 2         a = 1
 3         b = 'hello world'
 4         c = true
 5 
 6         d = {
 7            f1 = 12, f2 = 34, 
 8            1, 2, 3,
 9            add = function(self, a, b) 
10               print('d.add called')
11               return a + b 
12            end
13         }
14 
15         function e()
16             print('i am e')
17         end
18 
19         function f(a, b)
20             print('a', a, 'b', b)
21             return 1, {f1 = 1024}
22         end
23         
24         function ret_e()
25             print('ret_e called')
26             return e
27         end
28     ";

  如果沒有@符號,就會出現下面這種結果。

 

3.c#中是不允許用關鍵字作為標識符的,但是在關鍵字前加上@,就打破了這個界限。@int是可以存在,當做變量的。


文章列表


不含病毒。www.avast.com
arrow
arrow
    全站熱搜
    創作者介紹
    創作者 大師兄 的頭像
    大師兄

    IT工程師數位筆記本

    大師兄 發表在 痞客邦 留言(0) 人氣()