Groovyb指令碼速成教程

2021-04-13 00:43:18 字數 1814 閱讀 6245

1內容簡介

主要介紹了groovy的常用語法,以便快速上手應用.

2語法介紹

2.1螢幕輸出

println 「hello world!」

println 「hello」 + 「 world!」

2.2變數定義

classhelloworld

} 2.3類定義,函式定義

classhelloworld

defstring getstring(string input)

staticvoidmain(args)

} 2.4list用法

classhelloworld  

//list

,不可以動態增加大小

deflist = [

"dog"

, "cat"

, "bird"]

for(linlist)

//list array

deflists = [[

"liuyou"

, "22"

, "m"

],["liudehua"

, "33"

, "m"]]

for(linlists)

for(linlists)}}

}  

2.5map用法

classhelloworld

} 2.6邏輯語句

2.6.1if…else…

classhelloworld

} 2.6.2switch…case…

classhelloworld

}}

2.6.3while迴圈

classhelloworld

}}

2.6.4for迴圈

classhelloworld

}}

2.7try…catch…異常語句

classhelloworldcatch(exception e)

}defvoidtestthrow()

staticvoidmain(args)catch(arithmeticexception e)

}}

CSS速成教程 2

派生選擇器 通過依據元素在其位置的上下文關係來定義樣式,可以使標記更加簡潔。派生選擇器允許你根據文件的上下文關係來確定某個標籤的樣式。通過合理地使用派生選擇器,我們可以使 html 變得更加整潔。比方說,你希望列表中的 strong 元素變為紅色,而不是通常的黑色,可以這樣定義乙個派生選擇器 li ...

CSS速成教程 1

css 指的是層疊樣式表 cascading stylesheet 在網頁製作時採用層疊樣式表技術,可以有效地對頁面的布局 字型 顏色 背景和其它效果實現更加精確的控制。學習路徑 css 規則由兩個主要的部分構成 選擇器,以及一條或多條宣告。1 selector 選擇器通常是您需要改變樣式的 htm...

CSS速成教程 樣式2 5

在 css 的鏈結屬性設定中,我們能設定 color,font family,background 等等,不同的狀態我們可以設定對應的樣式。下面我們就來看看對應樣式的屬性設定。a link 普通的 未被訪問的鏈結 a visited 使用者已訪問的鏈結 a hover 滑鼠指標位於鏈結的上方 a a...