ASPL لباتASPL 0.7.0

Search documentation

Search starts with current English documentation · ASPL 0.7.0

Enter a complete name such as read_line, or words about a topic.

    العربية
    Source files

    Open one UTF-8 .aspl or .لبات file, up to 1 MiB, in a new draft. It stays in this browser and does not run automatically.

    Read a file and handle absence

    ASPL 0.7.0 · Current release

    Complete supplied source, preparation, and checked ASPL 0.7.0 outcomes.

    On this page

    Purpose and preparation

    Browser and native, ASPL 0.7.0. With missing.txt absent, send that name. Prints File: error: not-found\n and returns 0. No imported file is required for this outcome.

    See the current reference. No source module or external library is required.

    Read Text files and recoverable failures before importing data or writing a native destination. New browser drafts start with empty run files.

    Arabic source

    This supplied complete source opens a new draft. Prepare the declared inputs/files in that draft, then select Run explicitly.

    Browser and native · ASPL 0.7.0 · Arabic source

    Execution: Browser and native · ASPL 0.7.0

    Prerequisites:
    • For the declared outcome, missing.txt must be absent. No file asset is required.
    • For a successful read, open this new draft first, then import your UTF-8 data file into its Files control before Run; send its flat name.

    Input lines: ["missing.txt"]

    دالة ابدأ_الرئيسية() -> ص64 {
        اطبع("File: ").
        دع الاسم = اقرأ_سطر().
        دع المحتوى: نتيجة<نص> = اقرأ_ملف_نصي(الاسم).
        إذا (المحتوى::نجاح) {
            اطبع(المحتوى::قيمة).
        } وإلا {
            اطبع("error: ").
            اطبع(المحتوى::الخطأ::الرمز).
            اطبع("\س").
        }
        أرجع 0.
    }
    
    Download قراءة-ملف.لبات

    Expected outcomes
    {
      "browser": {
        "check": "success",
        "class": "success",
        "output": "File: error: not-found\n",
        "processStatus": 0
      },
      "native": {
        "check": 0,
        "status": 0,
        "output": "File: error: not-found\n"
      }
    }

    English source

    This supplied complete source opens a new draft. Prepare the declared inputs/files in that draft, then select Run explicitly.

    Browser and native · ASPL 0.7.0 · English source

    Execution: Browser and native · ASPL 0.7.0

    Prerequisites:
    • For the declared outcome, missing.txt must be absent. No file asset is required.
    • For a successful read, open this new draft first, then import your UTF-8 data file into its Files control before Run; send its flat name.

    Input lines: ["missing.txt"]

    fn start_main() -> i64 {
        print("File: ");
        let name = read_line();
        let content: result<string> = read_text_file(name);
        if (content::ok) {
            print(content::value);
        } else {
            print("error: ");
            print(content::error::code);
            print("\n");
        }
        return 0;
    }
    
    Download read-file.aspl

    Expected outcomes
    {
      "browser": {
        "check": "success",
        "class": "success",
        "output": "File: error: not-found\n",
        "processStatus": 0
      },
      "native": {
        "check": 0,
        "status": 0,
        "output": "File: error: not-found\n"
      }
    }

    Check the result

    The source cards show the catalog's exact inputs and outcomes. Locale changes do not translate the supplied source. Download retains original source bytes.

    Browse pages