小编sha*_*oit的帖子

How to throw a specific Exception in Julia

I am doing test driven development in Julia. The test expects a certain exception to be thrown. How do I throw the expected exception?

I'm looping through a string and counting the occurrence of specific letters. Any letter than 'A','C','G',or'T' should result in an exception

Running Julia version 1.2.0.

I have tried these alternatives:

  • throw(DomainError())
  • throw(DomainError)
  • throw("DomainError")

I expected those to work based on this resource: https://scls.gitbooks.io/ljthw/content/_chapters/11-ex8.html

这是我要解决的问题的链接:https : //exercism.io/my/solutions/781af1c1f9e2448cac57c0707aced90f

(请注意:该链接可能对我的登录名是唯一的)

我的代码:

function count_nucleotides(strand::AbstractString)

    Counts = Dict()
    Counts['A'] = …
Run Code Online (Sandbox Code Playgroud)

exception julia

3
推荐指数
1
解决办法
84
查看次数

标签 统计

exception ×1

julia ×1