From f53043763f8461b9bd43597daf10da3025fc79a1 Mon Sep 17 00:00:00 2001 From: MarcusTL12 Date: Thu, 12 Sep 2019 16:48:06 +0200 Subject: [PATCH] _ --- Code/16.Macro.jl | 5 ++++- Code/3.arithmetic.jl | 4 ++-- Code/4.strings.jl | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Code/16.Macro.jl b/Code/16.Macro.jl index 1cf5fb3..7ee313b 100644 --- a/Code/16.Macro.jl +++ b/Code/16.Macro.jl @@ -21,5 +21,8 @@ reallyslowfunction() = sleep(2) sleep(1) end - +# The @inbounds macro removes all checks to see if you try to acces elements +# outside any container, so might be faster, but definately more unsafe. +a = [1, 2, 3] +@inbounds println(a[2]) diff --git a/Code/3.arithmetic.jl b/Code/3.arithmetic.jl index f2af15a..debfa37 100644 --- a/Code/3.arithmetic.jl +++ b/Code/3.arithmetic.jl @@ -26,8 +26,8 @@ function main() # Integer division is done by div, fld or cld (floor divide/ceil divide) # div rounds towards zero (1.5 -> 1, -2.7 -> -2) - # floor rounds downwards (1.5 -> 1, -2.7 -> -3) - # ceil rounds upwards (1.5 -> 2, -2.7 -> -2) + # floor rounds downwards (1.5 -> 1, -2.7 -> -3) + # ceil rounds upwards (1.5 -> 2, -2.7 -> -2) c = div(a, b) c = fld(a, b) c = cld(a, b) diff --git a/Code/4.strings.jl b/Code/4.strings.jl index a6e5b72..e5aa626 100644 --- a/Code/4.strings.jl +++ b/Code/4.strings.jl @@ -56,7 +56,7 @@ println(s) println("a + b = ", a + b) -# The raw string macro is very useful when copying raw text and not +# The "raw" string macro is very useful when copying raw text and not # wanting to worry about special characters doing special stuff # (i.e. \n for new line). A common use for this is filepaths