Scripting languages such as JS and PHP define the scope of variables within a for loop and if statement

Source: Internet
Author: User
Tags php define
In scripting languages such as JS and PHP, the defined variables in the For loop will first refer to the For loop outside of Var L, (only once L is defined), so outside of the for loop can output L<...script>var a=0;if (a==0) {var i=1;} alert (i); for (Var j=0;j<5;j++) {}alert (J), for (Var k=0;k<5;k++) {var l=3;} Alert (l); in languages such as C # for (int i=0;i<5;i++) {string a= "abc";} There will be 5 string a at compile time;

Scripting languages such as JS and PHP define the scope of variables within a for loop and if statement

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.