So I'm writing a very basic 'Game' Program, just really started coding today, and am running into a problem. The tutorial I'm following, at http://home.cmit.net/rwolbeck/programmingtutorial/index.htm suggests that I do not need to specify that a variable is an integer variable, but whether I do or don't, BlitzMax stops compiling midway with an error message of "Compile Error: Unable to convert 'String' to 'Int'"
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>M.Gillespie Resume</title>
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/animate.css">
<link href="css/style.css" rel="stylesheet" type="text/css">
<script src="js/jQuery.js"></script>
<script src="js/helper.js"></script>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?libraries=places"></script>
</head>
<body>
<nav class="navbar navbar-default navbar-fixed-top animated bounceInRight"> <!-- Fixed Nav Bar -->
<div class="navbar-header navbar-right">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Top</a> <!-- NavBar Brand -->
</div>
<div class="navbar-collapse collapse " id="navbar-collapse1"> <!-- Links to Resume Sections -->
<ul class="nav navbar-nav navbar-right">
<li class="active, hover"><a href="#workExperience">Experience</a></li>
<li class="active, hover"><a href="#projects">Projects</a></li>
<li class="active, hover"><a href="#education">Education</a></li>
<li class="active, hover"><a href="#letsConnect">Connect</a></li>
</ul>
</div><!-- /.navbar-collapse -->
</nav>
<div class="container-fluid">
<div id="main">
<div id="header" class="center-content clearfix, animated bounceInDown">
<ul id="topContacts" class='flex-box'></ul>
</div>
<div style='clear: both;'></div>
<div id="workExperience" class='gray, animated bounceInDown'>
<h2>Experience</h2>
</div>
<div id="projects" class='gray, animated bounceInDown'>
<h2>Projects</h2>
</div>
<div id="education" class='gray, animated bounceInDown'>
<h2>Education</h2>
</div>
<div id="mapDiv" class=" animated bounceInDown">
<h2>Where I've Lived and Worked</h2>
</div>
<div id="letsConnect" class='dark-gray animated bounceInRight'>
<h2 class='orange center-text'>Let's Connect</h2>
<ul id="footerContacts" class="flex-box">
</ul>
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/resumeBuilder.js"></script>
<script type="text/javascript">
if(document.getElementsByClassName('flex-item').length === 0) {
document.getElementById('topContacts').style.display = 'none';
}
if(document.getElementsByTagName('h1').length === 0) {
document.getElementById('header').style.display = 'none';
}
if(document.getElementsByClassName('work-entry').length === 0) {
document.getElementById('workExperience').style.display = 'none';
}
if(document.getElementsByClassName('project-entry').length === 0) {
document.getElementById('projects').style.display = 'none';
}
if(document.getElementsByClassName('education-entry').length === 0) {
document.getElementById('education').style.display = 'none';
}
if(document.getElementsByClassName('flex-item').length === 0) {
document.getElementById('letsConnect').style.display = 'none';
}
if(document.getElementById('map') === null) {
document.getElementById('mapDiv').style.display = 'none';
}
</script>
</body>
</html>
Any ideas of what is going wrong, and how to fix it?
P.S. Just joined this site today but I did do multiple searches and didn't find anything answering this specific question/problem.
答案 0 :(得分:1)
这是问题:
answer = Input("What is 2 and 2? ")
你缺少&#34; $&#34;在你的回答&#34;变量告诉它它是一个整数(在经典的达特茅斯BASIC中,它将是一个浮点,&#34;%&#34;指定一个整数)。 INPUT函数返回一个字符串,该字符串不能填入数字。使用VAL函数进行类型转换,即
answer = Val(Input("What is 2 and 2? "))