渲染zh-Hant

作為

Translation status: 繁體中文 reader-locale proof. Term names and code fences follow the zh-Hant pack; supporting prose may still be English.

Introduces an alias name.

Aliases: as

Syntax: <name> 作為 <alias>

Category#

aliasing

Examples#

radix/corpus/ut/ut.fab (canonical · keyword)#

Introduces an alias name.

# =============================================================================
# 作為 — Introduces an alias name.
# =============================================================================
#
# What this teaches:
#   • Parameter aliasing — `作為` renames function parameters for clarity or disambiguation
#   • Import aliasing — also used in `匯入` contexts for renamed imports
#
# Common mistakes:
#   • confusing 作為 (import or parameter alias) with sicut (comparison) or velut (pattern match)
#
# See also: 取自, 引數
# =============================================================================



# 作為 — alias introducer
#
# GRAMMAR:
#   alias :← ident '作為' ident
#
# EXPECTED OUTPUT:
#   Scalar stdout smoke (see body).
#
# BACKEND:
#   Cross-ref: destructura/, 匯入/, 比對/ (per-field 作為).
#

fn greet(string location as loc) → string {
    return loc
}

main {
    print greet("Roma")
}

Expected output:

Roma