-
Notifications
You must be signed in to change notification settings - Fork 3
typing en
ab25cq edited this page Dec 12, 2018
·
6 revisions
There are two types of Clover type inference: type variable inference of local variable, type inference to block object. First is type inference of local variables.
a: int = 2;
Is
a: = 2;
You can write. The type of the variable is declared according to the type of the rvalue value.
Type inference to another block object is as follows.
a: lambda (int, int): int = lambda (a: int, b: int) {return a + b}
Depending on the return type, the return type of the block object is determined. (Return value: int can be omitted)
(From version 4.9.1 I am obliterating the omission of the return value of block object type inference.) I'm sorry.
Arguments and return values can be omitted in the method block. The arguments are declared as it, it2, it3, ....
{1,2,3}. each { it.toString().println() }
1
2
3
a:SortableList<String> = {1,2,3}.map{ it.toString() }
.
- フリーフォーマット
- 変数と関数について
- 条件分岐と演算子
- 論理演算子
- ビット演算子
- ループ
- ブロック
- コメント
- アノテーション
- ナルエイブル
- プリミティブクラス
- 配列
- クラス
- クラスフィールドとクラスメソッド
- dynamic_class
- boxingとunboxing
- プリミティブ型とスペシャルフィールド
- スペシャルメソッド
- インターフェース
- 移譲
- モジュール
- ジェネリクス
- メソッドジェネリクス
- 関数
- 列挙型(enum)
- 自動setterとgetterの定義
- when文
- 変数の宣言の取り消し
- 例外処理
- 多重代入
- 代入時の自動キャスト
- C言語へのFFI
- ローカル変数の宣言
- メモリーセーフなポインタ
- 例外演算子
- 糖衣構文