Try/Catch Block

A

AcidBath

I am new to JavaScript and need to find out if there is a something
like the try/catch block in visual basic?
 
L

Lee

AcidBath said:
I am new to JavaScript and need to find out if there is a something
like the try/catch block in visual basic?

Before you get to the point where you want to use try/catch, you
should really find yourself a manual that describes the language,
including try/catch blocks (which are supported in new browsers,
but not some older versions that are still in use).
 
T

Thomas 'PointedEars' Lahn

AcidBath said:
I am new to JavaScript and need to find out if there is a something
like the try/catch block in visual basic?

There is. And it is J(ava)Script and VB(Script).NET that implement
this exception handling syntax AFAIK introduced with Java. RTFM.


PointedEars
 
J

John W. Kennedy

Thomas said:
There is. And it is J(ava)Script and VB(Script).NET that implement
this exception handling syntax AFAIK introduced with Java.

C++ had it first, although Ada has something similar. Java introduced
the finally option.

--
John W. Kennedy
"But now is a new thing which is very old--
that the rich make themselves richer and not poorer,
which is the true Gospel, for the poor's sake."
-- Charles Williams. "Judgement at Chelmsford"
 
T

Thomas 'PointedEars' Lahn

John said:
C++ had it first, although Ada has something similar. Java introduced
the finally option.

Are you sure? AFAIK and according to Wikipedia, exceptions were only a
late addition to C++.


PointedEars
 
J

John W. Kennedy

Thomas said:
Are you sure? AFAIK and according to Wikipedia, exceptions were only a
late addition to C++.

Late compared to other things, and late in being widely implemented, but
I know I wrote my first Java code back in the 1.0 days (1996 or so), and
I recognized "try/catch" as being derived from C++ at that time.

And, on looking matters up, I find that, in fact, exceptions were
accepted into C++ in 1990, when Java was still an internal research
project at Sun (named, at one point, C++--).

As I say, Ada had something quite similar even earlier, but since Ada
(like ALGOL, PL/I, or Pascal) has nested procedures/functions/blocks,
the exception specifications were tied to them, whereas C++, lacking
those constructs, had to invent the /try/ keyword to delimit the range
in which an exception may be caught. Other languages have exceptions,
but Ada is the earliest one that I personally know of in which
exceptions are carried in programmer-defined objects, with arbitrary
attributes.

--
John W. Kennedy
"But now is a new thing which is very old--
that the rich make themselves richer and not poorer,
which is the true Gospel, for the poor's sake."
-- Charles Williams. "Judgement at Chelmsford"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top