🎨 format

This commit is contained in:
ValKmjolnir
2025-06-02 13:27:04 +08:00
parent 240095ab37
commit 2cc5bb8625
97 changed files with 539 additions and 538 deletions

View File

@@ -258,7 +258,7 @@ While loop and for loop is simalar to C/C++.
while(condition) {
continue;
}
for(var i = 0; i<10; i += 1) {
for (var i = 0; i<10; i += 1) {
break;
}
```
@@ -469,7 +469,7 @@ Then complete this function using C++:
var builtin_print(context* ctx, gc* ngc) {
// find value with index begin from 1
// because local[0] is reserved for value 'me'
for(auto& i : ctx->localr[1].vec().elems) {
for (auto& i : ctx->localr[1].vec().elems) {
std::cout << i;
}
std::cout << std::flush;
@@ -495,11 +495,11 @@ var builtin_keys(context* ctx, gc* ngc) {
auto res = ngc->temp = ngc->alloc(vm_vec);
auto& vec = res.vec().elems;
if (hash.type==vm_hash) {
for(const auto& iter : hash.hash().elems) {
for (const auto& iter : hash.hash().elems) {
vec.push_back(ngc->newstr(iter.first));
}
} else {
for(const auto& iter : hash.map().mapper) {
for (const auto& iter : hash.map().mapper) {
vec.push_back(ngc->newstr(iter.first));
}
}
@@ -645,7 +645,7 @@ Then we write a test nasal file to run this fib function:
use std.dylib;
var dlhandle = dylib.dlopen("libfib");
var fib = dlhandle.fib;
for(var i = 1; i<30; i += 1)
for (var i = 1; i<30; i += 1)
println(dylib.dlcall(fib, i));
dylib.dlclose(dlhandle.lib);
```
@@ -663,7 +663,7 @@ use std.dylib;
var dlhandle = dylib.dlopen("libfib");
var fib = dlhandle.fib;
var invoke = dylib.limitcall(1); # this means the called function has only one parameter
for(var i = 1; i<30; i += 1)
for (var i = 1; i<30; i += 1)
println(invoke(fib, i));
dylib.dlclose(dlhandle.lib);
```