본문 바로가기
⌨️flutter

3.Dart-Operator(다트 연산자)

by 덩크냥 2022. 8. 15.

목표 : 수 계산과 String안에 넣어서 결과출력

기본적인 + - * / % 는 기본언어랑 같다.

Operators

*Unary Operators

unaryoperator

*Assignment Operators

assignmentoperators

TypeCasting

-int.parse();

parse

-double.parse();

double.parse

-toString();

toString()
bool to String

Relational Operators

== , != , < , > , <= , >=

Logical Operators

&& , ||

Tenary Operators( Dart에만 있는 개념)

A ? B : C (if a == true| select B Else Select C)

Ex)

int age = 16;

String a = age > 17 ? 'Adult' : 'Child';

bool b = age > 12 ? true : false;

TenaryOperator

Null Safety ( null 에서 오는 오류 방지 )

만약 int a; print(a); 이러면 실행이 에러난다.

=> int? a; print(a); 이러면 출력값이 'null' 이다.

? null safety

PS. 이상한 문법 발견

 

is 문법

num 의 type 이 int 면 true 인것이다. 저런식으로도 쓰는 방법이 있다..