From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,LOTS_OF_MONEY autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8002154d2966e1a1 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-11-03 18:44:20 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed1.bredband.com!bredband!newsspool1.bredband.com!news2.bredband.com.POSTED!not-for-mail From: "Per Sandbergs" Newsgroups: comp.lang.ada References: <5Ldx9.3695$151.38236@weber.videotron.net> Subject: Re: Local vs global variables in ADA X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Message-ID: Date: Sun, 3 Nov 2002 20:03:30 +0100 NNTP-Posting-Host: 213.114.165.145 X-Complaints-To: news-abuse@bredband.com X-Trace: news2.bredband.com 1036350173 213.114.165.145 (Sun, 03 Nov 2002 20:02:53 CET) NNTP-Posting-Date: Sun, 03 Nov 2002 20:02:53 CET Organization: A customer of B2 Bredbandsbolaget (www.bredband.com) Xref: archiver1.google.com comp.lang.ada:30335 Date: 2002-11-03T20:03:30+01:00 List-Id: First Read the Ada manual: Then on uour specific question It is a mater of scope so have a look at the folowing: procedure main is V_main_1 : integer := 0; procedure s1 is v_s1_1 : integer := 0; begin null; -- V_main_1 and V_s1_1 is vissible here; end; begin --main declare V_Main_2 : integer := 0; begin null; -- V_main_1, V_main_2 and V_s1_1 is vissible here; end; -- V_main_1 is vissible here; end main; So think of it as a tree wher the main trunk is the "main" procedure and all branches will see back towards the main trunk but not other branches. /Per Sandberg "Roger" wrote in message news:5Ldx9.3695$151.38236@weber.videotron.net... > Yes I'm an Ada newbie and have a questions about local and global variables. > When exactly is a variable said to be global? > > for example I have this code > --main procedure > Procedure Main Is > --If I declare a variable here will it be considered as > --global to the sub procedures? > > > --sub procedure > Procedure Sub > > Begin > > End Sub; > > > > Begin > --If I declare a variable here will it be considered as > --global to the sub procedure? > End Main; > > > > > > any help is appreciated. > >