Skip to content

Conditional if variable == something #16879

Discussion options

You must be logged in to vote

You nested your ifs.

Your code says this:

If release_check is release, then puts "release", then check if release_check is "pre_release",
  then puts "pre_release", then check if release_check is "skip_release",
    then puts "skip_release", endif
  endif
endif

You should check out how ruby if works here: https://www.tutorialspoint.com/ruby/ruby_if_else.htm

In short, you'll want this:

puts release_check
if release_check == release
  puts "release"
elsif release_check == pre_release
  puts "pre_release"
elsif release_check == skip_release
  puts "skip_release"
end

Also, if release, pre_release and skip_release are strings and not variables, you'll need to add quotation marks around them.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by shanehughes1990
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants