File tree 1 file changed +6
-2
lines changed
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -1249,7 +1249,9 @@ If you apply :func:`super` to other type objects (or non-type objects), a
1249
1249
As one application of these ideas, Julia includes a parametric type,
1250
1250
``Val{T} ``, designated for dispatching on bits-type *values *. For
1251
1251
example, if you pass a boolean to a function, you have to test the
1252
- value at run-time::
1252
+ value at run-time:
1253
+
1254
+ .. doctest ::
1253
1255
1254
1256
function firstlast(b::Bool)
1255
1257
return b ? "First" : "Last"
@@ -1258,7 +1260,9 @@ value at run-time::
1258
1260
println(firstlast(true))
1259
1261
1260
1262
You can instead cause the conditional to be evaluated during function
1261
- compilation by using the ``Val `` trick::
1263
+ compilation by using the ``Val `` trick:
1264
+
1265
+ .. doctest ::
1262
1266
1263
1267
firstlast(::Val{true}) = "First"
1264
1268
firstlast(::Val{false}) = "Last"
You can’t perform that action at this time.
0 commit comments