小编For*_*ods的帖子

获取 SyntaxError:词法声明不能出现在单语句上下文中

我的代码的 let 部分产生了一个错误我想出了为什么机器人不会通过将 client.login 移动到底部来启动新错误包括它只是垃圾邮件“无效的邮政编码。请遵循以下格式:_weather <### ##>" 即使你输入了邮政编码

client.on("message", (message) => {
    if (message.content.includes("_weather") && message.author.bot === false)
        let zipCode = message.content.split(" ")[1];
    if (zipCode === undefined || zipCode.length != 5 || parseInt(zipCode) === NaN) {
        message.channel.send("`Invalid Zip Code. Please follow the format: _weather <#####>`")
            .catch(console.error);
        return;
    } else {
        fetch(`https://openweathermap.org/data/2.5/weather?zip=${zipCode},us&appid=439d4b804bc8187953eb36d2a8c26a02`)
            .then(response => {
                return response.json();
            })
            .then(parsedWeather => {
                if (parsedWeather.cod === '404') {
                    message.channel.send("`This zip code does not exist or there is no information avaliable.`");
                } else { …
Run Code Online (Sandbox Code Playgroud)

javascript node.js discord.js

0
推荐指数
1
解决办法
2552
查看次数

只有一个变量正在打印 C++

//libraries
#include <iostream>

//standard namepace
using namespace std;


int Car() {
    int a;
    int b;
    
    cout << "Fuel Tank" << endl;
    cin >> a;
    cout << "MPG" << endl;
    cin >> b;

    return a, b;
}
int main() {
    int a;
    int b;
    
    a,b = Car();
    
    cout << "Print Values " << (a,b);    // <--- Line 25

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

假设您将 10 和 15 作为第一个和第二个输入。为什么 15 是cout第 25 行语句中唯一要打印的变量。

c++ visual-c++

0
推荐指数
1
解决办法
78
查看次数

标签 统计

c++ ×1

discord.js ×1

javascript ×1

node.js ×1

visual-c++ ×1