switch statement - Is there anyway I can use if else inside ruby case..end -


case search_term when 'a'   ptr = 0 when 'b'   ptr = 1 when 'c'    ptr = 2 else   ptr = 99 end  if location = 'xyz' , search_term = 'c' ptr = 0 end 

is there way include if above in case statement?

ptr = case search_term when 'a'    0 when 'b'    1 when 'c'    if location == 'xyz'  #note ==     0    else      2   end  else   99 end 

Comments

Popular posts from this blog

sql server - Cannot query correctly (MSSQL - PHP - JSON) -

php - trouble displaying mysqli database results in correct order -

C++ Linked List -