随笔分类 -  nim语言学习笔记

nim语言配置nimcache编译缓存
摘要:找到nim安装路径:D:\nim-2.2.2_x64\nim-2.2.2\config 然后打开nim.cfg,在最后一行写入:nimcache=r"F:\nimcache\$projectname" 给高手看的nimcache底层实现: 实现位于 nim/compiler/options.nim: 阅读全文
posted @ 2025-08-12 20:51 小沙盒工作室 阅读(10) 评论(0) 推荐(0)
nim语言配置nimble路径
摘要:​​设置全局环境变量 NIMBLE_DIR​​ 阅读全文
posted @ 2025-08-12 20:14 小沙盒工作室 阅读(3) 评论(0) 推荐(0)
nim语言的fmt
摘要:import strformat var user_name = "abc" echo fmt"内插字符串{user_name}" 阅读全文
posted @ 2025-08-12 18:34 小沙盒工作室 阅读(4) 评论(0) 推荐(0)
nim语言获取windows用户名
摘要:先安装winim nimble install winim import winim/lean const UNLEN = 256 proc getCurrentUserName(): string = var buffer: array[UNLEN + 1, char] # 用户名缓冲区(UNLE 阅读全文
posted @ 2025-08-12 18:22 小沙盒工作室 阅读(4) 评论(0) 推荐(0)
nim中的三元运算符
摘要:var backupFileName = unpack ? args[1]: args[2]; var tarFileName = unpack ? args[2] : args[1]; nim var backupFileName = if unpack: args[1] else: args[2 阅读全文
posted @ 2025-06-29 09:14 小沙盒工作室 阅读(5) 评论(0) 推荐(0)
Java中的System.exit(1)与nim对应语法
摘要:import os quit(1) 阅读全文
posted @ 2025-06-29 09:06 小沙盒工作室 阅读(5) 评论(0) 推荐(0)
nim解析读取json文件
摘要:import json const config = "config.json" var jsonNode = json.parseFile(config) 阅读全文
posted @ 2025-06-24 08:17 小沙盒工作室 阅读(8) 评论(0) 推荐(0)
nim写的程序编译成32位的
摘要:nim c --cpu:i386 code.nim 阅读全文
posted @ 2025-06-23 18:56 小沙盒工作室 阅读(8) 评论(0) 推荐(0)
nim 2.2.2 配置32位gcc
摘要:# Configuration for the GNU C/C++ compiler: @if windows: #gcc.path = r"$nim\dist\mingw\bin" i386.windows.gcc.path = r"F:\program files\nim-1.6.6_x64\n 阅读全文
posted @ 2025-06-22 11:19 小沙盒工作室 阅读(12) 评论(0) 推荐(0)
Nim语言-配置vscode代码补全(nim-lsp)
摘要:安装Nim安装Vscodenimble install nimlsp安装Vscode nim-lsp插件找到编译好的nim-lsp.exe 并把它放入path环境变量也可以在插件里配置一下(顺带)重启Vscode一切正常的话会有这个提示最终效果: 阅读全文
posted @ 2022-09-12 13:28 小沙盒工作室 阅读(34) 评论(0) 推荐(0)
Nim语言学习-字符串的值转换为int
摘要:import std/strutils var param = "12" var a = parseInt(param) echo a 阅读全文
posted @ 2022-09-09 21:42 小沙盒工作室 阅读(8) 评论(0) 推荐(0)
Nim语言-获取用户输入(类似python的input,C的scanf)
摘要:import os var a = stdin.readLine() echo "你输入了:" & a 运行结果 阅读全文
posted @ 2022-09-09 21:11 小沙盒工作室 阅读(7) 评论(0) 推荐(0)
nim路径字符串斜杠替换
摘要:import std/strutils import os var path = r"D:\游戏\terasology\TerasologyLauncher-windows64\TerasologyLauncher-windows64-4.5.0" var b = path.replace("\\" 阅读全文
posted @ 2022-08-30 10:49 小沙盒工作室 阅读(8) 评论(0) 推荐(0)
nim学习笔记-使用mingw32编译x86架构的exe
摘要:首先,我们需要去官网下载mingw32 然后解压到编程语言的dist目录(注意,不要配置mingw32的环境变量,会和mingw64的环境变量冲突)。 然后编辑nim语言的默认配置文件: D:\nim-1.6.6_x64\nim-1.6.6\config\nim.cfg 找到windows平台的if 阅读全文
posted @ 2022-08-05 08:59 小沙盒工作室 阅读(7) 评论(0) 推荐(0)
nim语言学习笔记-创建一个函数体为空的函数(过程)
摘要:直接上代码: proc fx() = discard 下面是python的写法 def fx(): pass 下面是gdscript的写法(godot游戏引擎内置语言) func fx(): pass 阅读全文
posted @ 2022-08-05 08:43 小沙盒工作室 阅读(8) 评论(0) 推荐(0)