ProgramGen / tasks /data /reverse /aaveshdev__dragon.e4245fe /environment /assets /examples /basics.dgn
ProgramGen / tasks /data /reverse /aaveshdev__dragon.e4245fe /environment /assets /examples /basics.dgn
Download tasks/data/reverse/aaveshdev__dragon.e4245fe/environment/assets/examples/basics.dgn from Lego-X/ProgramGen: direct link, hf CLI and curl.
- Browser
- Download file 1.56 kB
-
https://huggingface.co/datasets/Lego-X/ProgramGen/resolve/main/tasks/data/reverse/aaveshdev__dragon.e4245fe/environment/assets/examples/basics.dgn
- Command line
-
hf download hf://datasets/Lego-X/ProgramGen/tasks/data/reverse/aaveshdev__dragon.e4245fe/environment/assets/examples/basics.dgn
-
curl -L -o basics.dgn https://huggingface.co/datasets/Lego-X/ProgramGen/resolve/main/tasks/data/reverse/aaveshdev__dragon.e4245fe/environment/assets/examples/basics.dgn
1.56 kB
| // ───────────────────────────────────────────────────────────── | |
| // basics.dgn | |
| // Dragon language basics: variables, output, and string interpolation | |
| // Run with: dragon basics.dgn | |
| // ───────────────────────────────────────────────────────────── | |
| func main() { | |
| // Variables are dynamically typed — no keyword required. | |
| name = "Dragon" | |
| version = 1.0 | |
| // `showln` prints with a trailing newline, `show` prints without one. | |
| // Backtick strings support {expr} interpolation. | |
| showln(`Welcome to ${name} v${version}!`) | |
| age = 5 | |
| is_awesome = True | |
| showln("age:", age, "| awesome:", is_awesome) | |
| // `const` values cannot be reassigned after they're set. | |
| const GREETING = "Hello" | |
| showln(GREETING + ", World!") | |
| // Basic arithmetic | |
| a = 10 | |
| b = 3 | |
| showln(`${a} + ${b} = ${a + b}`) | |
| showln(`${a} - ${b} = ${a - b}`) | |
| showln(`${a} * ${b} = ${a * b}`) | |
| showln(`${a} / ${b} = ${a / b}`) | |
| showln(`${a} % ${b} = ${a % b}`) | |
| // format() gives you fine-grained control over output | |
| pi = 3.14159 | |
| showln(format("Pi rounded to 2 places: {:.2f}", pi)) | |
| showln(format("Padded number: [{:>6}]", 42)) | |
| // typeof() and conversions | |
| showln("typeof age:", typeof(age)) | |
| showln("str(age):", str(age)) | |
| showln("int(\"42\"):", int("42")) | |
| } | |
| main() | |