标签[scope]

范围是将值和表达式关联在一起的封闭上下文。 对于涉及不同类型范围的问题以及范围可能不清楚的问题,请使用此标签。

0
1回复
42

如何为函数作用域定义新作用域

I wonder if there's a way to define a varibles to a function local [[Scopes]] for example the following function我想知道是否有一种方法可以将变量定义为本地[[Scopes]]函数,例如以下
0
0回复
31

实例化点和第二阶段依赖名称查找,C++17与遗留

I was surprised that this did not work: see on Compiler Explorer, with compiler version and options to match my project我很惊讶这不起作用:在编译器资源管理器上查看,编译器版本和选项
0
3回复
54

将局部变量名称与c中的参数名称相同是一种不好的做法吗?

For example, in the below code scope of local variable num should be only within else but is it a bad practice?例如,在下面的代码中,局部变量 num 的范围应该只在 else 内,但这是一
-1
2回复
29

没有用于调用Class::Method的匹配函数

When trying to implement a Priority Search Tree, i get this error when trying to build the tree尝试实现优先搜索树时,尝试构建树时出现此错误 error: no matching function for
1
0回复
11

为什么这个函数表达式必须使用IIFE才能产生我正在寻找的结果?

I'm working my way through Kyle Simpson's 'You Don't Know JS Yet' and I'm having trouble understanding a code example in the Scope and Closures chapte
-1
1回复
27

与while循环相关的变量范围显示错误,而在while循环之后访问它显示错误

import java.util.*;public class gcd { public static void main(String[] args){ Scanner scn = new Scanner(System.in);
0
0回复
26

无论如何,SpotifyWebAPI都给了我非法的范围

I am trying to set up an open source github project on my own netlify to break it down and learn from it.我正在尝试在我自己的 netlify 上建立一个开源 github 项目来分解它并从中学习
1
2回复
99

C++中全局变量的替代品

I need to set a variable in the main function and access it from a different function in the same file.我需要在主函数中设置一个变量并从同一文件中的不同函数访问它。 I can not pass i
0
1回复
27

从条目小部件获取数据时的范围问题

I am making a login and register screen using tkinter.我正在使用 tkinter 进行登录和注册屏幕。 I have a function to make the login and register screen ( named form ),
-1
2回复
24

Python中的基本障碍:保留函数内部的更新值

I am sure this problem will be solved in 30seconds by someone who knows, but my attempts have certainly gone longer than that...我相信这个问题会在 30 秒内被知道的人解决
0
0回复
18

Puppeteerpage.evalute找不到块作用域变量

function clickElement(page, selector, textTarget) { page.evaluate(() => { [...document.querySelectorAll(selector)] .find((element) => e
0
2回复
36

为什么我的按钮无法在loacalhost.3000上呈现?

my button can't compile and the mistake is:"./src/components/Button.js Line 2: 'React' must be in scope when using JSX react/react-in-jsx-scope".我的按钮无
2
2回复
57

为了在JavaScript中提高性能,避免多次声明函数会更好吗?[关闭]

Closed . 关闭。 This question is opinion-based . 这个问题是基于意见的。 It is not currently accepting answers. 它目前不
0
1回复
21

是否能够在Spring中使用构造函数注入将RequestScopebean注入Singletonbean?

It is working as far as I tested.据我测试,它正在工作。 But I do not get it why and how it works.(Also I am not sure it is safe to use in production)但我不明白它为什么以及如
3
2回复
111

在函数参数列表中向前声明的类型如何在函数作用域之外可见?[复制]

This question already has an answer here : 这个问题在这里已经有了答案: Class declaration inside function parameter li
0
1回复
19

即使我在循环之外对其进行了初始化,Python变量也会在每个循环中更新

Working on a little Fallout minigame in python...在 python 中开发一个小辐射迷你游戏...... I have a function called level_up that allows player to distribute skill
0
1回复
38

使另一个函数可以访问本地结构实例(C++)

So I have a struct which holds variables for entities within a game (hit points, x and y coordinates, etc) and I have the struct declared globally.所以我
0
1回复
28

在哪里定义用于C++类的模板成员变量的常量?

Suppose I want to define a class Foo which has a member variable that is also a template Bar<int num> baz .假设我想定义一个Foo类,它有一个成员变量,它也是一个模板Bar<i
-3
1回复
17

如何访问位于全局范围内的函数中的输入值

let value1 = document.getElementById('input1').value;function display(){ console.log(value1); }display() // value1 (wanted this result) it seems that
0
1回复
10

值被声明并且仅在打字稿中的if语句之外使用

In typescript I have code as follows:在打字稿中,我的代码如下:let a = 'null'if (condition) { const a = 'condition was met'}const result = getName(a) However, com

1 2 3 4 5 6 7 8 9 10 下一页