Dart 파일 실행하기
Coddy의 R 개발자를 위한 Dart 코스 레슨. 48개 중 1번째.
R 경험을 스탠드얼론 Dart에 적용해 보세요. 제공된 프로그램을 변경 없이 실행해 보세요. Dart는 스크립트를 위에서 아래로 실행하는 대신 main에서 시작하며, 인사말은 명시적으로 임포트한 라이브러리에서 가져옵니다. 이 코스에서는 Flutter나 외부 패키지 없이 기초, null safety, 함수, 컬렉션 및 객체 모델을 배웁니다.
챌린지
쉬움제공된 프로그램을 수정하지 않고 실행하세요. Dart is ready를 출력합니다. welcome.dart의 message()가 인사말을 제공합니다.
편집 가능한 파일에서 출력하지 마세요. 제공된 exercise.dart는 입력을 파싱하고 출력을 반환하며, 잠긴 드라이버가 공개 API를 독립적으로 검사하고 줄바꿈 하나와 함께 결과를 출력합니다.
작성할 코드는 welcome.dart, exercise.dart에 들어갑니다. main.dart에는 제공된 입출력 코드가 포함되어 있으며 수정할 수 없습니다.
직접 해보기
import 'dart:io';
import 'dart:convert';
import 'exercise.dart';
import 'welcome.dart';
void check(bool condition){if(!condition)throw StateError('Public API contract failed');}
Future<void> main() async {
final raw=await stdin.transform(utf8.decoder).join();
final input=raw.replaceFirst(RegExp(r'\r?\n$'),'');
stdout.writeln(solve(input));
}
R 개발자를 위한 Dart의 모든 레슨
직접 연습해 보세요: 온라인 Dart 컴파일러