Conditional if variable == something #16879
-
Hello everyone, I am working on building out my fastlane file, I need a conditional if statement I need to run different parts of a lane depending on what that variable is. IE GITHUB_RELEASE_CHECK=pre_release then run the puts "pre_release" section
Apologies I am learning ruby because of fastlane so this is new to me |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
You nested your ifs. Your code says this:
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. |
Beta Was this translation helpful? Give feedback.
-
You sir saved me so much headache. That worked like a charm, I have literally put 2 days in of ruby learning, so this is very new, thank you very much for getting back to me quickly. Now I know how to switch lanes conditionally sweet 👍 (And maybe some other new comers some headache) for anyone else
Fastfile
|
Beta Was this translation helpful? Give feedback.
You nested your ifs.
Your code says this:
You should check out how ruby if works here: https://www.tutorialspoint.com/ruby/ruby_if_else.htm
In short, you'll want this:
Also, if release, pre_release and skip_release are strings and not variables, you'll need to add quotation marks around them.