File: Keywords.html

package info (click to toggle)
octave 10.3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 145,388 kB
  • sloc: cpp: 335,976; ansic: 82,241; fortran: 20,963; objc: 9,402; sh: 8,756; yacc: 4,392; lex: 4,333; perl: 1,544; java: 1,366; awk: 1,259; makefile: 660; xml: 192
file content (789 lines) | stat: -rw-r--r-- 40,035 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
<!DOCTYPE html>
<html>
<!-- Created by GNU Texinfo 7.1.1, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Keywords (GNU Octave (version 10.3.0))</title>

<meta name="description" content="Keywords (GNU Octave (version 10.3.0))">
<meta name="keywords" content="Keywords (GNU Octave (version 10.3.0))">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta name="viewport" content="width=device-width,initial-scale=1">

<link href="index.html" rel="start" title="Top">
<link href="Concept-Index.html" rel="index" title="Concept Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Grammar-and-Parser.html" rel="up" title="Grammar and Parser">
<link href="Parser.html" rel="next" title="Parser">
<style type="text/css">
<!--
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
div.example {margin-left: 3.2em}
span:hover a.copiable-link {visibility: visible}
strong.def-name {font-family: monospace; font-weight: bold; font-size: larger}
-->
</style>
<link rel="stylesheet" type="text/css" href="octave.css">


</head>

<body lang="en">
<div class="section-level-extent" id="Keywords">
<div class="nav-panel">
<p>
Next: <a href="Parser.html" accesskey="n" rel="next">Parser</a>, Up: <a href="Grammar-and-Parser.html" accesskey="u" rel="up">Grammar and Parser</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<h3 class="section" id="Keywords-1"><span>F.1 Keywords<a class="copiable-link" href="#Keywords-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-keywords"></a>

<p>The identifiers below are keywords, and may not be used as variable
or function names:
</p>
<h4 class="subsubheading" id="Categories_003a-20"><span>Categories:<a class="copiable-link" href="#Categories_003a-20"> &para;</a></span></h4>

<p><a class="ref" href="#XREFkwcategoryUtilityFunctions">Utility&nbsp;Functions<!-- /@w --></a> |
<a class="ref" href="#XREFkwcategoryVariableDeclaration">Variable&nbsp;Declaration<!-- /@w --></a> |
<a class="ref" href="#XREFkwcategoryFunctionDefinition">Function&nbsp;Definition<!-- /@w --></a> |
<a class="ref" href="#XREFkwcategoryControlStructures">Control&nbsp;Statements<!-- /@w --></a> |
<a class="ref" href="#XREFkwcategoryIteratingStructures">Iterating&nbsp;Structures<!-- /@w --></a> |
<a class="ref" href="#XREFkwcategoryClassdefStructures">Classdef&nbsp;Structures<!-- /@w --></a> |
<a class="ref" href="#XREFkwcategoryExecutionEnvironment">Execution&nbsp;Environment<!-- /@w --></a>
</p>
<h4 class="subsubheading" id="Alphabetical-keyword-listing_003a"><span>Alphabetical keyword listing:<a class="copiable-link" href="#Alphabetical-keyword-listing_003a"> &para;</a></span></h4>

<p><a class="ref" href="#XREF_005f_005fFILE_005f_005f">__FILE__</a> |
<a class="ref" href="#XREF_005f_005fLINE_005f_005f">__LINE__</a> |
<a class="ref" href="#XREFbreak">break</a> |
<a class="ref" href="#XREFcase">case</a> |
<a class="ref" href="#XREFcatch">catch</a> |
<a class="ref" href="#XREFclassdef">classdef</a> |
<a class="ref" href="#XREFcontinue">continue</a> |
<a class="ref" href="#XREFdo">do</a> |
<a class="ref" href="#XREFelse">else</a> |
<a class="ref" href="#XREFelseif">elseif</a> |
<a class="ref" href="#XREFend">end</a> |
<a class="ref" href="#XREFend_005ftry_005fcatch">end_try_catch</a> |
<a class="ref" href="#XREFend_005funwind_005fprotect">end_unwind_protect</a> |
<a class="ref" href="#XREFendclassdef">endclassdef</a> |
<a class="ref" href="#XREFendenumeration">endenumeration</a> |
<a class="ref" href="#XREFendevents">endevents</a> |
<a class="ref" href="#XREFendfor">endfor</a> |
<a class="ref" href="#XREFendfunction">endfunction</a> |
<a class="ref" href="#XREFendif">endif</a> |
<a class="ref" href="#XREFendmethods">endmethods</a> |
<a class="ref" href="#XREFendparfor">endparfor</a> |
<a class="ref" href="#XREFendproperties">endproperties</a> |
<a class="ref" href="#XREFendswitch">endswitch</a> |
<a class="ref" href="#XREFendwhile">endwhile</a> |
<a class="ref" href="#XREFenumeration">endenumeration</a> |
<a class="ref" href="#XREFevents">events</a> |
<a class="ref" href="#XREFfor">for</a> |
<a class="ref" href="#XREFfunction">function</a> |
<a class="ref" href="#XREFglobal">global</a> |
<a class="ref" href="#XREFif">if</a> |
<a class="ref" href="#XREFkwpropertymethods">methods</a> |
<a class="ref" href="#XREFotherwise">otherwise</a> |
<a class="ref" href="#XREFparfor">parfor</a> |
<a class="ref" href="#XREFpersistent">persistent</a> |
<a class="ref" href="#XREFkwpropertyproperties">properties</a> |
<a class="ref" href="#XREFreturn">return</a> |
<a class="ref" href="#XREFswitch">switch</a> |
<a class="ref" href="#XREFtry">try</a> |
<a class="ref" href="#XREFuntil">until</a> |
<a class="ref" href="#XREFunwind_005fprotect">unwind_protect</a> |
<a class="ref" href="#XREFunwind_005fprotect_005fcleanup">unwind_protect_cleanup</a> |
<a class="ref" href="#XREFwhile">while</a>
</p>
<a class="anchor" id="XREFkwcategoryUtilityFunctions"></a><h4 class="subheading" id="Utility-Functions_003a"><span>Utility Functions:<a class="copiable-link" href="#Utility-Functions_003a"> &para;</a></span></h4>
<p>The function <code class="code">iskeyword</code> can be used to quickly check whether an
identifier is reserved by Octave.
</p>
<a class="anchor" id="XREFiskeyword"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-iskeyword"><span><strong class="def-name">iskeyword</strong> <code class="def-code-arguments">()</code><a class="copiable-link" href="#index-iskeyword"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-iskeyword-1"><span><strong class="def-name">iskeyword</strong> <code class="def-code-arguments">(<var class="var">name</var>)</code><a class="copiable-link" href="#index-iskeyword-1"> &para;</a></span></dt>
<dd><p>Return true if <var class="var">name</var> is an Octave keyword.
</p>
<p>If <var class="var">name</var> is omitted, return a list of keywords.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="Variables.html#XREFisvarname">isvarname</a>, <a class="ref" href="Status-of-Variables.html#XREFexist">exist</a>.
</p></dd></dl>


<a class="anchor" id="XREFkwcategoryVariableDeclaration"></a><h4 class="subheading" id="Variable-Declaration_003a"><span>Variable Declaration:<a class="copiable-link" href="#Variable-Declaration_003a"> &para;</a></span></h4>

<a class="anchor" id="XREFglobal"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-global"><span><strong class="def-name">global</strong> <code class="def-code-arguments"><var class="var">var</var></code><a class="copiable-link" href="#index-global"> &para;</a></span></dt>
<dd><p>Declare variables to have global scope.
</p>
<div class="example">
<div class="group"><pre class="example-preformatted">global <var class="var">x</var>;
if (isempty (<var class="var">x</var>))
  x = 1;
endif
</pre></div></div>

<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFpersistent">persistent</a>.
</p></dd></dl>


<a class="anchor" id="XREFpersistent"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-persistent"><span><strong class="def-name">persistent</strong> <code class="def-code-arguments"><var class="var">var</var></code><a class="copiable-link" href="#index-persistent"> &para;</a></span></dt>
<dd><p>Declare variables as persistent.
</p>
<p>A variable that has been declared persistent within a function will retain its
contents in memory between subsequent calls to the same function.  The
difference between persistent variables and global variables is that persistent
variables are local in scope to a particular function and are not visible
elsewhere.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFglobal">global</a>.
</p></dd></dl>


<a class="anchor" id="XREFkwcategoryFunctionDefinition"></a><h4 class="subheading" id="Function-Definition_003a"><span>Function Definition:<a class="copiable-link" href="#Function-Definition_003a"> &para;</a></span></h4>

<a class="anchor" id="XREFfunction"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-function"><span><strong class="def-name">function</strong> <code class="def-code-arguments"><var class="var">outputs</var> = function_name (<var class="var">input</var>, &hellip;)</code><a class="copiable-link" href="#index-function"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-function-1"><span><strong class="def-name">function</strong> <code class="def-code-arguments"> function_name (<var class="var">input</var>, &hellip;)</code><a class="copiable-link" href="#index-function-1"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-function-2"><span><strong class="def-name">function</strong> <code class="def-code-arguments"><var class="var">outputs</var> = function_name</code><a class="copiable-link" href="#index-function-2"> &para;</a></span></dt>
<dd><p>Begin a function body with name <code class="code">function_name</code>, with <var class="var">outputs</var> as
results, and with <var class="var">inputs</var> as parameters.
</p>
<p>The function can later be invoked in Octave using the syntax
</p>
<div class="example">
<pre class="example-preformatted">[<var class="var">output1</var>, <var class="var">output2</var>, ...] = function_name (<var class="var">input1</var>, <var class="var">input2</var>, ...)
</pre></div>


<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFreturn">return</a>.
</p></dd></dl>


<a class="anchor" id="XREFendfunction"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-endfunction"><span><strong class="def-name">endfunction</strong><a class="copiable-link" href="#index-endfunction"> &para;</a></span></dt>
<dd><p>Mark the end of a function.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFfunction">function</a>.
</p></dd></dl>


<a class="anchor" id="XREFend"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-end"><span><strong class="def-name">end</strong><a class="copiable-link" href="#index-end"> &para;</a></span></dt>
<dd><p>Last element of an array or the end of any <code class="code">for</code>, <code class="code">parfor</code>,
<code class="code">if</code>, <code class="code">do</code>, <code class="code">while</code>, <code class="code">function</code>, <code class="code">switch</code>,
<code class="code">try</code>, or <code class="code">unwind_protect</code> block.
</p>
<p>As an index of an array, the magic index <code class="code">&quot;end&quot;</code> refers to the
last valid entry in an indexing operation.
</p>
<p>Example:
</p>
<div class="example">
<div class="group"><pre class="example-preformatted"><var class="var">x</var> = [ 1 2 3; 4 5 6 ];
<var class="var">x</var>(1,end)
 &rArr; 3
<var class="var">x</var>(end,1)
 &rArr; 4
<var class="var">x</var>(end,end)
 &rArr; 6
</pre></div></div>

<p>Programming notes:
</p><ol class="enumerate">
<li> The <code class="code">end</code> keyword cannot be used within <code class="code">subsref</code>,
<code class="code">subsasgn</code>, or <code class="code">substruct</code> for manual indexing operations.

</li><li> For custom classes, to enable use of <code class="code">end</code> in indexing expressions it
must be overloaded with a function definition such as:

<div class="example">
<div class="group"><pre class="example-preformatted">function last_index = end (obj, end_dim, ndim_obj)
  if (end_dim == ndim_obj)
    last_index = prod (size (obj)(end_dim:ndim_obj));
  else
    last_index = size (obj, end_dim);
  endif
endfunction
</pre></div></div>

<p>For more information see
<a class="ref" href="Object-Oriented-Programming.html">Object Oriented Programming</a>.
</p></li></ol>


<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFfor">for</a>, <a class="ref" href="#XREFparfor">parfor</a>, <a class="ref" href="#XREFif">if</a>, <a class="ref" href="#XREFdo">do</a>, <a class="ref" href="#XREFwhile">while</a>, <a class="ref" href="#XREFfunction">function</a>, <a class="ref" href="#XREFswitch">switch</a>, <a class="ref" href="#XREFtry">try</a>, <a class="ref" href="#XREFunwind_005fprotect">unwind_protect</a>.
</p></dd></dl>


<a class="anchor" id="XREFreturn"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-return-1"><span><strong class="def-name">return</strong><a class="copiable-link" href="#index-return-1"> &para;</a></span></dt>
<dd><p>Return execution control immediately from a function or script to the calling
code.
</p>
<p><code class="code">return</code> is used to stop executing code and exit an m-file immediately
rather than continuing until the end of the function or script is reached.
</p>
<p>If the function or script was invoked directly, rather than from calling code
in an m-file, then Octave returns to the command line.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFfunction">function</a>.
</p></dd></dl>


<a class="anchor" id="XREFkwcategoryControlStructures"></a><h4 class="subheading" id="Control-Statements_003a"><span>Control Statements:<a class="copiable-link" href="#Control-Statements_003a"> &para;</a></span></h4>

<a class="anchor" id="XREFif"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-if"><span><strong class="def-name">if</strong> <code class="def-code-arguments">(<var class="var">cond</var>) &hellip; endif</code><a class="copiable-link" href="#index-if"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-if-1"><span><strong class="def-name">if</strong> <code class="def-code-arguments">(<var class="var">cond</var>) &hellip; else &hellip; endif</code><a class="copiable-link" href="#index-if-1"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-if-2"><span><strong class="def-name">if</strong> <code class="def-code-arguments">(<var class="var">cond</var>) &hellip; elseif (<var class="var">cond</var>) &hellip; endif</code><a class="copiable-link" href="#index-if-2"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-if-3"><span><strong class="def-name">if</strong> <code class="def-code-arguments">(<var class="var">cond</var>) &hellip; elseif (<var class="var">cond</var>) &hellip; else &hellip; endif</code><a class="copiable-link" href="#index-if-3"> &para;</a></span></dt>
<dd><p>Begin an if block.
</p>
<p>The conditional <var class="var">cond</var> is true if it is not empty and if <em class="emph">all</em> values
are nonzero.
</p>
<div class="example">
<div class="group"><pre class="example-preformatted">x = 1;
if (x == 1)
  disp (&quot;one&quot;);
elseif (x == 2)
  disp (&quot;two&quot;);
else
  disp (&quot;not one or two&quot;);
endif
</pre></div></div>

<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFswitch">switch</a>.
</p></dd></dl>


<a class="anchor" id="XREFelse"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-else"><span><strong class="def-name">else</strong><a class="copiable-link" href="#index-else"> &para;</a></span></dt>
<dd><p>Alternate action for an if block.
</p>
<p>See <code class="code">if</code> for an example.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFif">if</a>.
</p></dd></dl>


<a class="anchor" id="XREFelseif"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-elseif"><span><strong class="def-name">elseif</strong> <code class="def-code-arguments">(<var class="var">cond</var>)</code><a class="copiable-link" href="#index-elseif"> &para;</a></span></dt>
<dd><p>Alternate conditional test for an if block.
</p>
<p>The conditional <var class="var">cond</var> is true if it is not empty and if <em class="emph">all</em> values
are nonzero.
</p>
<p>See <code class="code">if</code> for an example.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFif">if</a>.
</p></dd></dl>


<a class="anchor" id="XREFendif"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-endif"><span><strong class="def-name">endif</strong><a class="copiable-link" href="#index-endif"> &para;</a></span></dt>
<dd><p>Mark the end of an if block.
</p>
<p>See <code class="code">if</code> for an example.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFif">if</a>.
</p></dd></dl>


<a class="anchor" id="XREFswitch"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-switch"><span><strong class="def-name">switch</strong> <code class="def-code-arguments"><var class="var">statement</var></code><a class="copiable-link" href="#index-switch"> &para;</a></span></dt>
<dd><p>Begin a switch block.
</p>
<div class="example">
<div class="group"><pre class="example-preformatted">yesno = &quot;yes&quot;;

switch (yesno)
  case {&quot;Yes&quot; &quot;yes&quot; &quot;YES&quot; &quot;y&quot; &quot;Y&quot;}
    value = 1;
  case {&quot;No&quot; &quot;no&quot; &quot;NO&quot; &quot;n&quot; &quot;N&quot;}
    value = 0;
  otherwise
    error (&quot;invalid value&quot;);
endswitch
</pre></div></div>

<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFif">if</a>, <a class="ref" href="#XREFcase">case</a>, <a class="ref" href="#XREFotherwise">otherwise</a>.
</p></dd></dl>


<a class="anchor" id="XREFcase"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-case"><span><strong class="def-name">case</strong> <code class="def-code-arguments"><var class="var">value</var></code><a class="copiable-link" href="#index-case"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-case-1"><span><strong class="def-name">case</strong> <code class="def-code-arguments">{<var class="var">value</var>, &hellip;}</code><a class="copiable-link" href="#index-case-1"> &para;</a></span></dt>
<dd><p>A case statement in a switch block.
</p>
<p>Octave cases are exclusive and do not fall-through as do C-language cases.  A
switch statement must have at least one case.  See <code class="code">switch</code> for an
example.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFswitch">switch</a>.
</p></dd></dl>


<a class="anchor" id="XREFotherwise"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-otherwise"><span><strong class="def-name">otherwise</strong><a class="copiable-link" href="#index-otherwise"> &para;</a></span></dt>
<dd><p>The default statement in a switch block which is executed when no other
case statements match the input.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFswitch">switch</a>, <a class="ref" href="#XREFcase">case</a>.
</p></dd></dl>


<a class="anchor" id="XREFendswitch"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-endswitch"><span><strong class="def-name">endswitch</strong><a class="copiable-link" href="#index-endswitch"> &para;</a></span></dt>
<dd><p>Mark the end of a switch block.
</p>
<p>See <code class="code">switch</code> for an example.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFswitch">switch</a>.
</p></dd></dl>


<a class="anchor" id="XREFtry"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-try"><span><strong class="def-name">try</strong><a class="copiable-link" href="#index-try"> &para;</a></span></dt>
<dd><p>Begin a try-catch block.
</p>
<p>If an error occurs within a try block, then the catch code will be run and
execution will proceed after the catch block (though it is often recommended to
use the <code class="code">lasterr</code> function to re-throw the error after cleanup is
completed).
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFcatch">catch</a>, <a class="ref" href="#XREFunwind_005fprotect">unwind_protect</a>.
</p></dd></dl>


<a class="anchor" id="XREFcatch"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-catch-1"><span><strong class="def-name">catch</strong><a class="copiable-link" href="#index-catch-1"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-catch-2"><span><strong class="def-name">catch</strong> <code class="def-code-arguments"><var class="var">value</var></code><a class="copiable-link" href="#index-catch-2"> &para;</a></span></dt>
<dd><p>Begin the cleanup part of a try-catch block.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFtry">try</a>.
</p></dd></dl>


<a class="anchor" id="XREFend_005ftry_005fcatch"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-end_005ftry_005fcatch-1"><span><strong class="def-name">end_try_catch</strong><a class="copiable-link" href="#index-end_005ftry_005fcatch-1"> &para;</a></span></dt>
<dd><p>Mark the end of a <code class="code">try-catch</code> block.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFtry">try</a>, <a class="ref" href="#XREFcatch">catch</a>.
</p></dd></dl>


<a class="anchor" id="XREFunwind_005fprotect"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-unwind_005fprotect"><span><strong class="def-name">unwind_protect</strong><a class="copiable-link" href="#index-unwind_005fprotect"> &para;</a></span></dt>
<dd><p>Begin an unwind_protect block.
</p>
<p>If an error occurs within the first part of an unwind_protect block the
commands within the unwind_protect_cleanup block are executed before the error
is thrown.  If an error is not thrown, then the unwind_protect_cleanup block is
still executed.  In other words, the unwind_protect_cleanup code is guaranteed
to execute regardless of success or failure in the unwind_protect block.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFunwind_005fprotect_005fcleanup">unwind_protect_cleanup</a>, <a class="ref" href="#XREFtry">try</a>.
</p></dd></dl>


<a class="anchor" id="XREFunwind_005fprotect_005fcleanup"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-unwind_005fprotect_005fcleanup-1"><span><strong class="def-name">unwind_protect_cleanup</strong><a class="copiable-link" href="#index-unwind_005fprotect_005fcleanup-1"> &para;</a></span></dt>
<dd><p>Begin the cleanup section of an unwind_protect block.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFunwind_005fprotect">unwind_protect</a>.
</p></dd></dl>


<a class="anchor" id="XREFend_005funwind_005fprotect"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-end_005funwind_005fprotect-1"><span><strong class="def-name">end_unwind_protect</strong><a class="copiable-link" href="#index-end_005funwind_005fprotect-1"> &para;</a></span></dt>
<dd><p>Mark the end of an unwind_protect block.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFunwind_005fprotect">unwind_protect</a>.
</p></dd></dl>


<a class="anchor" id="XREFkwcategoryIteratingStructures"></a><h4 class="subheading" id="Iterating-Structures_003a"><span>Iterating Structures:<a class="copiable-link" href="#Iterating-Structures_003a"> &para;</a></span></h4>

<a class="anchor" id="XREFfor"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-for"><span><strong class="def-name">for</strong> <code class="def-code-arguments"><var class="var">i</var> = <var class="var">range</var></code><a class="copiable-link" href="#index-for"> &para;</a></span></dt>
<dd><p>Begin a for loop.
</p>
<div class="example">
<div class="group"><pre class="example-preformatted">for i = 1:10
  i
endfor
</pre></div></div>

<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFparfor">parfor</a>, <a class="ref" href="#XREFdo">do</a>, <a class="ref" href="#XREFwhile">while</a>.
</p></dd></dl>


<a class="anchor" id="XREFendfor"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-endfor"><span><strong class="def-name">endfor</strong><a class="copiable-link" href="#index-endfor"> &para;</a></span></dt>
<dd><p>Mark the end of a for loop.
</p>
<p>See <code class="code">for</code> for an example.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFfor">for</a>.
</p></dd></dl>


<a class="anchor" id="XREFwhile"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-while"><span><strong class="def-name">while</strong> <code class="def-code-arguments">(<var class="var">cond</var>)</code><a class="copiable-link" href="#index-while"> &para;</a></span></dt>
<dd><p>Begin a while loop.
</p>
<p>The conditional <var class="var">cond</var> is true if it is not empty and if <em class="emph">all</em> values
are nonzero.
</p>
<div class="example">
<div class="group"><pre class="example-preformatted">i = 0;
while (i &lt; 10)
  i++
endwhile
</pre></div></div>

<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFdo">do</a>, <a class="ref" href="#XREFendwhile">endwhile</a>, <a class="ref" href="#XREFfor">for</a>, <a class="ref" href="#XREFuntil">until</a>.
</p></dd></dl>


<a class="anchor" id="XREFendwhile"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-endwhile"><span><strong class="def-name">endwhile</strong><a class="copiable-link" href="#index-endwhile"> &para;</a></span></dt>
<dd><p>Mark the end of a while loop.
</p>
<p>See <code class="code">while</code> for an example.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFdo">do</a>, <a class="ref" href="#XREFwhile">while</a>.
</p></dd></dl>


<a class="anchor" id="XREFdo"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-do"><span><strong class="def-name">do</strong><a class="copiable-link" href="#index-do"> &para;</a></span></dt>
<dd><p>Begin a do-until loop.
</p>
<p>This differs from a while loop in that the body of the loop is executed at
least once.
</p>
<div class="example">
<div class="group"><pre class="example-preformatted">i = 0;
do
  i++
until (i == 10)
</pre></div></div>

<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFfor">for</a>, <a class="ref" href="#XREFuntil">until</a>, <a class="ref" href="#XREFwhile">while</a>.
</p></dd></dl>


<a class="anchor" id="XREFuntil"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-until"><span><strong class="def-name">until</strong> <code class="def-code-arguments">(<var class="var">cond</var>)</code><a class="copiable-link" href="#index-until"> &para;</a></span></dt>
<dd><p>End a do-until loop.
</p>
<p>The conditional <var class="var">cond</var> is true if it is not empty and if <em class="emph">all</em> values
are nonzero.
</p>
<p>See <code class="code">do</code> for an example.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFdo">do</a>.
</p></dd></dl>


<a class="anchor" id="XREFparfor"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-parfor"><span><strong class="def-name">parfor</strong> <code class="def-code-arguments"><var class="var">i</var> = <var class="var">range</var></code><a class="copiable-link" href="#index-parfor"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-parfor-1"><span><strong class="def-name">parfor</strong> <code class="def-code-arguments">(<var class="var">i</var> = <var class="var">range</var>, <var class="var">maxproc</var>)</code><a class="copiable-link" href="#index-parfor-1"> &para;</a></span></dt>
<dd><p>Begin a for loop that may execute in parallel.
</p>
<p>A <code class="code">parfor</code> loop has the same syntax as a <code class="code">for</code> loop.  If your Octave
session has a parallel processing pool enabled, the iterations of the
<code class="code">parfor</code> loop will be executed in parallel across the pool&rsquo;s workers.
Otherwise, <code class="code">parfor</code> will behave exactly as <code class="code">for</code>.
</p>
<p>When operating in parallel mode, a <code class="code">parfor</code> loop&rsquo;s iterations are not
guaranteed to occur sequentially, and there are additional restrictions about
the data access operations you can do inside the loop body.
</p>
<p><strong class="strong">Warning:</strong> parallel processing pools are currently unimplemented in
Octave; <code class="code">parfor</code> currently behaves exactly as a normal <code class="code">for</code> loop.
</p>
<div class="example">
<div class="group"><pre class="example-preformatted">parfor i = 1:10
  i
endparfor
</pre></div></div>

<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFfor">for</a>, <a class="ref" href="#XREFdo">do</a>, <a class="ref" href="#XREFwhile">while</a>.
</p></dd></dl>


<a class="anchor" id="XREFendparfor"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-endparfor"><span><strong class="def-name">endparfor</strong><a class="copiable-link" href="#index-endparfor"> &para;</a></span></dt>
<dd><p>Mark the end of a parfor loop.
</p>
<p>See <code class="code">parfor</code> for an example.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFparfor">parfor</a>.
</p></dd></dl>


<a class="anchor" id="XREFbreak"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-break"><span><strong class="def-name">break</strong><a class="copiable-link" href="#index-break"> &para;</a></span></dt>
<dd><p>Exit the innermost enclosing do, while, or for loop.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFdo">do</a>, <a class="ref" href="#XREFwhile">while</a>, <a class="ref" href="#XREFfor">for</a>, <a class="ref" href="#XREFparfor">parfor</a>, <a class="ref" href="#XREFcontinue">continue</a>.
</p></dd></dl>


<a class="anchor" id="XREFcontinue"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-continue"><span><strong class="def-name">continue</strong><a class="copiable-link" href="#index-continue"> &para;</a></span></dt>
<dd><p>Jump to the end of the innermost enclosing do, while, or for loop.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFbreak">break</a>, <a class="ref" href="#XREFdo">do</a>, <a class="ref" href="#XREFwhile">while</a>, <a class="ref" href="#XREFfor">for</a>, <a class="ref" href="#XREFparfor">parfor</a>.
</p></dd></dl>


<a class="anchor" id="XREFkwcategoryClassdefStructures"></a><h4 class="subheading" id="Classdef-Structures_003a"><span>Classdef Structures:<a class="copiable-link" href="#Classdef-Structures_003a"> &para;</a></span></h4>

<a class="anchor" id="XREFclassdef"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-classdef"><span><strong class="def-name">classdef</strong><a class="copiable-link" href="#index-classdef"> &para;</a></span></dt>
<dd><p>Begin a classdef block.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="Properties.html#XREFproperties">properties</a>, <a class="ref" href="Creating-a-Class.html#XREFmethods">methods</a>, <a class="ref" href="#XREFevents">events</a>, <a class="ref" href="#XREFenumeration">enumeration</a>.
</p></dd></dl>


<a class="anchor" id="XREFendclassdef"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-endclassdef"><span><strong class="def-name">endclassdef</strong><a class="copiable-link" href="#index-endclassdef"> &para;</a></span></dt>
<dd><p>Mark the end of a classdef definition.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFclassdef">classdef</a>.
</p></dd></dl>


<a class="anchor" id="XREFkwpropertyproperties"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>

<dl class="first-deftypefn">
<dt class="deftypefn" id="index-properties-3"><span><strong class="def-name">properties</strong><a class="copiable-link" href="#index-properties-3"> &para;</a></span></dt>
<dd><p>Mark the beginning of a block of properties in a classdef definition.  Note
that the <a class="ref" href="Properties.html#XREFproperties">function <code class="code">&quot;properties&quot;</code></a> is a function
that lists the properties of a classdef class or object.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFendproperties">endproperties</a>.
</p></dd></dl>

<a class="anchor" id="XREFendproperties"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-endproperties"><span><strong class="def-name">endproperties</strong><a class="copiable-link" href="#index-endproperties"> &para;</a></span></dt>
<dd><p>Mark the end of a properties block in a classdef definition.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="Properties.html#XREFproperties">properties</a>.
</p></dd></dl>


<a class="anchor" id="XREFkwpropertymethods"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>

<dl class="first-deftypefn">
<dt class="deftypefn" id="index-methods-4"><span><strong class="def-name">methods</strong><a class="copiable-link" href="#index-methods-4"> &para;</a></span></dt>
<dd><p>Mark the beginning of a block of methods in a classdef definition.  Note that
the <a class="ref" href="Creating-a-Class.html#XREFmethods">function <code class="code">&quot;methods&quot;</code></a> is a function that lists
the methods of a class or object.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFendmethods">endmethods</a>.
</p></dd></dl>

<a class="anchor" id="XREFendmethods"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-endmethods"><span><strong class="def-name">endmethods</strong><a class="copiable-link" href="#index-endmethods"> &para;</a></span></dt>
<dd><p>Mark the end of a methods block in a classdef definition.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="Creating-a-Class.html#XREFmethods">methods</a>.
</p></dd></dl>


<a class="anchor" id="XREFevents"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-events"><span><strong class="def-name">events</strong><a class="copiable-link" href="#index-events"> &para;</a></span></dt>
<dd><p>Begin an events block in a classdef definition.
</p></dd></dl>


<a class="anchor" id="XREFendevents"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-endevents"><span><strong class="def-name">endevents</strong><a class="copiable-link" href="#index-endevents"> &para;</a></span></dt>
<dd><p>Mark the end of an events block in a classdef definition.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFevents">events</a>.
</p></dd></dl>


<a class="anchor" id="XREFenumeration"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-enumeration"><span><strong class="def-name">enumeration</strong><a class="copiable-link" href="#index-enumeration"> &para;</a></span></dt>
<dd><p>Begin an enumeration block in a classdef definition.
</p></dd></dl>


<a class="anchor" id="XREFendenumeration"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-endenumeration"><span><strong class="def-name">endenumeration</strong><a class="copiable-link" href="#index-endenumeration"> &para;</a></span></dt>
<dd><p>Mark the end of an enumeration block in a classdef definition.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFenumeration">enumeration</a>.
</p></dd></dl>


<a class="anchor" id="XREFkwcategoryExecutionEnvironment"></a><h4 class="subheading" id="Execution-Environment_003a"><span>Execution Environment:<a class="copiable-link" href="#Execution-Environment_003a"> &para;</a></span></h4>

<a class="anchor" id="XREF_005f_005fFILE_005f_005f"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-_005f_005fFILE_005f_005f"><span><strong class="def-name">__FILE__</strong><a class="copiable-link" href="#index-_005f_005fFILE_005f_005f"> &para;</a></span></dt>
<dd><p>When the lexer recognizes the <code class="code">&quot;__FILE__&quot;</code> keyword it returns a character
array containing the full name and path of the file that is being executed.
<code class="code">&quot;__FILE__&quot;</code> will return <code class="code">&quot;stdin&quot;</code> if called from the command line.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="#XREF_005f_005fLINE_005f_005f">__LINE__</a>.
</p></dd></dl>


<a class="anchor" id="XREF_005f_005fLINE_005f_005f"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-_005f_005fLINE_005f_005f"><span><strong class="def-name">__LINE__</strong><a class="copiable-link" href="#index-_005f_005fLINE_005f_005f"> &para;</a></span></dt>
<dd><p>When the lexer recognizes the <code class="code">&quot;__LINE__&quot;</code> keyword it returns a numeric
value containing the current input line number of the function or file being
executed.  <code class="code">&quot;__LINE__&quot;</code> will return <code class="code">1</code> if called from the command
line.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="#XREF_005f_005fFILE_005f_005f">__FILE__</a>.
</p></dd></dl>


</div>
<hr>
<div class="nav-panel">
<p>
Next: <a href="Parser.html">Parser</a>, Up: <a href="Grammar-and-Parser.html">Grammar and Parser</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>