goto - 为什么这个 GOTO 在 BASIC 256 中不起作用?
问题描述
2 Print "What is your name"
input nameperson$
Print "What is your Dad's name"
input ageperson$
Print "Your Name is ";nameperson$;" ";ageperson$
GOTO 2
为什么此代码在 BASIC 256 中不起作用?我已经在 QB64 中尝试过它并且它有效。
解决方案
自从我上次使用 BASIC 编程已经有好几年了,但我记得该语言有不同的风格(C、Pascal 和其他语言也是如此)。
我搜索了一些QB64和Basic 256:简短的回答是QB64的 BASIC 风格支持行号,但Basic 256实现了不支持行号的新 BASIC 风格。
为了GOTO
在BASIC 256中使用,您必须使用标签(任何标识符后跟冒号“:”)
thisIsALabel: Print "What is your name"
input nameperson$
Print "What is your Dad's name"
input ageperson$
Print "Your Name is ";nameperson$;" ";ageperson$
GOTO thisIsALabel
推荐阅读
- asp.net-mvc - jQuery数据表分页不适用于mvc视图
- javascript - 如何根据来自另一个 div 的类增加/减少宽度?
- python - 我想从另一个 python 文件中导入一个变量(Django)
- c++ - C1001:包含时编译器发生内部错误
- excel - 在 Excel 中,在图表标题中使用字符串连接公式时出现问题
- bash - 将多个文件单独合并为一个文件
- codeigniter - 强化扫描 - 可能的变量覆盖:全局范围
- mocking - 我正在尝试使用 mockaroo curl 请求生成一个 csv 文件,但我没有在响应中获得完整的 1000 条记录。可能是什么原因?
- c# - 从 JSON 字符串中获取键值对
- android - java - 如何将java中的方法引用(::)替换为普通的构造函数调用?