write Line(line: string) - > ()- 모듈
- std.
io → - 수신자
- 해당 없음
- 최소 인자 수
- 1
- 최대 인자 수
- 1
Signature and parameters
링크사용 조건
기본 포함 · 미정
Import std.io in language mode 5.21.
The selected 5.21 module exports writeLine. Installed default-distribution execution is tracked by the shared check/run fixture.
수신자
매개변수 제약
std. takes one string argument. On a successful host write, it writes that string followed by a newline to standard output and returns ().
결과
std. takes one string argument. On a successful host write, it writes that string followed by a newline to standard output and returns ().
효과
std. takes one string argument. On a successful host write, it writes that string followed by a newline to standard output and returns ().
실패
A failed std. call raises a dedicated host-output runtime fault at that call.
The Topaz 6.0 fault is TPZ4010. Successful writes retain the normal unit result.
관련 규칙 · Host write failures →Import std.io and call io.writeLine with one string argument.
Result and effects
링크writeLine contract
std. takes one string argument. On a successful host write, it writes that string followed by a newline to standard output and returns ().
이유
One string argument keeps value formatting separate from output. Appending a newline makes each successful call complete a line.
String and newline boundaries
std. preserves the supplied string and appends one newline on a successful host write. An empty string writes one newline. Unicode characters and embedded newlines are retained. The function returns (); a non-string argument is a type error. A failed host write produces a structured runtime fault.
이유
Preserving input avoids changing Unicode text or embedded line breaks. One appended newline gives empty and nonempty strings the same output rule.
Failures and boundaries
링크Host write failures
A failed std. call raises a dedicated host-output runtime fault at that call.
The Topaz 6.0 fault is TPZ4010. Successful writes retain the normal unit result.
이유
Keeping the unit signature preserves the existing call contract. A structured fault makes a host write failure visible to the program runner.
Host output diagnostic
링크Host output failure
- 계열
- topaz
- 단계
- run
- 코드
TPZ4010- 연산
- std.io.writeLine
원인과 조건
A failed std. call raises a dedicated host-output runtime fault at that call.
The Topaz 6.0 fault is TPZ4010. Successful writes retain the normal unit result.
관련 규칙 · Host write failures →대응
Use a working standard output sink. Keep output recovery in the embedding host until structured fault production is available.
Example
링크Run the first program
링크import std.iofunction greet(name: string) -> string {return "Hello, {name}!"}io.writeLine(greet("Topaz"))
Hello, Topaz!
기대 결과
기대 결과
실행을 마칩니다. 종료 코드 0.
Hello, Topaz!
관측한 단언 · 통과 · 5.21.3
종료 코드 0.
Hello, Topaz!
표준 오류 출력 없음.
- 통과 · expected 0; observed 0
- 통과 · stdout matches the authored expectation
- 통과 · stderr matches the authored expectation
관측한 단언 · 통과 · 5.21.3
종료 코드 0.
Hello, Topaz!
표준 오류 출력 없음.
- 통과 · expected 0; observed 0
- 통과 · stdout matches the authored expectation
- 통과 · stderr matches the authored expectation
Write empty, Unicode, and multiline strings
링크import std.ioio.writeLine("")io.writeLine("토파즈")let result: () = io.writeLine("a\nb")io.writeLine("{result}")
토파즈
a
b
()
기대 결과
기대 결과
실행을 마칩니다. 종료 코드 0.
토파즈ab()
Reject a non-string argument
링크import std.ioio.writeLine(1)
표준 출력 없음.기대 결과
기대 결과
거절 단계 check. 종료 코드가 0이 아닙니다.
write-line-string-argument-type at
write-line-bad.tpz:2:14
A successful write has a Unit result
링크import std.iolet result: () = io.writeLine("hello")
표준 출력 없음.기대 결과
기대 결과
검사가 프로그램을 받아들입니다. 종료 코드 0.
A write result cannot use Result propagation
링크import std.iofunction greeting() -> Result<(), string> {io.writeLine("hello")?Ok(())}
표준 출력 없음.기대 결과
기대 결과
거절 단계 check. 종료 코드가 0이 아닙니다.
result-required-for-propagation at
write-line-not-result.tpz:4:3