我正在学习 Ada 编程语言,我可以承认它是强类型的。在这段代码中,我试图让用户输入 4 个整数,然后使用递归打印出这些数字。但是,我在为它编写递归子程序时遇到了麻烦,想知道我是否可以获得有关如何正确编写它的任何建议?
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
procedure Dugga is
Y: Natural;
type arr is
array (1..4) of Natural;
A:arr;
function Recurs(Item: in Natural) return Natural is
begin
if Item >= 1 then
return Get(Item ); --Error: Context requires function call, found procedure name
end if;
end Recurs;
begin
Y:=Recurs(arr); --Error: expected type "Standard.Integer. Found type: arr
end Dugga;
Run Code Online (Sandbox Code Playgroud)
警告:Program_error 可能会在运行时引发
“return”语句丢失,此语句之后
错误:在调用 get 时缺少参数“Item”的参数
我有一个 json 文件,其中包含包含表情符号的字符串
\n{\n "messages": "This is a test -bla-bla test."\n}\nRun Code Online (Sandbox Code Playgroud)\n我的Python代码是:
\nwith open('config.json', 'r') as config_file:\n config = json.load(config_file)\nprint(config["messages"])\nRun Code Online (Sandbox Code Playgroud)\n输出是:
\n\n\n这是一个测试 \xc3\xb0\xc5\xb8\xe2\x80\x9c\xe2\x80\x98-bla-bla 测试。
\n
如何解决这个表情符号编码问题?
\n